Pergunta

I'm trying to figure out if there's a way in mathematica where I can solve for particular variables when given other variables and a set of equations. Essentially there are 6 variables, and I'm given 3 of them and have to calculate the others using these equations-

Variables-

B,Qs,f0,R,c,L

Equations-

f0=1/(2*Pi*Sqrt[L*c])

Qs=(w*L)/R

w=2*Pi*f0

B=f0/Qs

We are given the values of any 3 of those variables and have to figure out the rest using those values.

I was thinking perhaps using Eliminate but I'm not sure exactly how that would be structured as I've only used it previously with set variables that don't change and a single output.

Foi útil?

Solução

When using the Solve function with Mathematica, you can specify for what variables you want Solve to specify the solutions. Note that Solve may not be able to find expressions in terms of these variables (if the equations you give it are contradictory or insufficient) or for all values as some functions have no inverse or only partial inverses.

Your question looks a lot like homework in Electromagnetics, but here is an example with your original problem. You will have to adapt these ideas to give to Solve the set of variables you are looking for. Also remember to use == to specify equality testing. A simple = is for immediate assignment to a variable.

Solve[{f0 == 1/(2*Pi*Sqrt[L*c]),  Qs == (w*L)/R,  w == 2*Pi*f0,  B == f0/Qs}, {f0, B, c}]

{{f0->w/(2 [Pi]), B->w/(2 [Pi] Qs), c->L/(Qs^2 R^2)}}

enter image description here

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top