4
$\begingroup$

First off, I want to apologize for my poor English as I am not a native speaker.

In my physics research, I had to solve a system of equations, from which I would get a solution for the speed of an object. I simplified the equations so instead of physical values (mass of air, mass of rocket etc.) there are parameters (a, b etc.)

Here is the system for anyone interested:

Solve[{ b y^2/2 + a x^2/2 + c z^2/2 == e, a x == b y + c z, (a + c)*q^2/2 + c z^2/2 == f, (a + c)*q == c z}, {x, y, z, q} ]

And the value I am searching for is x.

Obviously the solution is very long.

Here it is:

x=speed of missile=[(0.5*(-2.8284271247461903* a^2 c Sqrt[f (a+c)]-1* \[Sqrt](-8* a^5 b c f+21.74625462767236*a^5 b c-8* a^4 b^2 c f+21.74625462767236a^4 b^2 c-48* a^4 b c^2 f+130.47752776603417*a^4 b c^2-40*a^3 b^2 c^2 f+130.47752776603417*a^3 b^2 c^2-104*a^3 b c^3 f+260.95505553206834*a^3 b c^3-64*a^2 b^2 c^3 f+260.95505553206834*a^2 b^2 c^3-96*a^2 b c^4 f+173.9700370213789*a^2 b c^4-32*a b^2 c^4 f+173.9700370213789*a b^2 c^4-32* a b c^5 f)-5.656854249492381*a c^2 Sqrt[f (a+c)]))/(a^3 Sqrt[c (a+2* c)]+a^2 b Sqrt[c (a+2*c)]+2*a^2 c Sqrt[c (a+2*c)]+2*a b c Sqrt[c (a+2*c)])

And the solution is correct. But here a problem arises, all the parameters are 'connected' and can be expressed by two variables. Is there a clever way to exchange all the parameters for the equations of their physical quantities.

For example, if I know that:

b= (((100x* (1.5-y)* 28.97)/(8.31 * 288*1000))-((-0.5229242)(1/(288*(x/1)^((1-1.4)/1.4))))

and

c= y

and

d=((100x* (1.5-y)* 28.97)/(8.31 * 288*1000))

and so on

Is there a way to change all parameters in the solution to equations of their physical properties. By doing this I would get an equation which I can plot in 3d and then analyze.

I really hope I was clear. Thanks in advance!

$\endgroup$
9
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory Tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Commented Aug 14, 2015 at 19:34
  • $\begingroup$ The equations you showed are not compatible with Mathematica format. Could you show the actual Mathematica commands you used in solving this system of equations from which you obtained the expression for $x$ that you reported? $\endgroup$
    – MarcoB
    Commented Aug 14, 2015 at 19:51
  • $\begingroup$ @MarcoB Yes of course. The command I used was : solve:[((by^2)/2)+((ax^2)/2)+((cz^2)/2)=e , ax=by+cz , (((a+c)*q^2)/2)+((cz^2)/2)=f ,((a+c)*q)=cz ],{x,y,z, q} $\endgroup$ Commented Aug 14, 2015 at 20:37
  • 5
    $\begingroup$ I just want to comment that your "poor English" is better than far too many native speakers/writers... $\endgroup$
    – ciao
    Commented Aug 14, 2015 at 21:16
  • 3
    $\begingroup$ Blaz, let me point you to these two questions on this site that are a wonderful collection of resources for beginners and experience users alike: What are the most common pitfalls awaiting new users?, and Where can I find examples of good Mathematica programming practice?. Both have a "basic" section with quite a few interesting pointers etc. The second question also has a lot of pointers to tutorials and learning guides that you might find useful. $\endgroup$
    – MarcoB
    Commented Aug 14, 2015 at 21:46

1 Answer 1

2
$\begingroup$

I think you are looking for the function With. From the documentation:

With[{x=x0, y=y0, ...}, expr}

specifies that in expr all occurrences of x, y, ... should be replace by x0, y0, ...

In your example you would write something like:

With[
  {
   b = ((100 x*(1.5 - y)*28.97)/(8.31*288*1000)) - ...,
   c = y,
   d = ((100 x*(1.5 - y)*28.97)/(8.31*288*1000)),
   ...
   },

  (0.5*(-2.8284271247461903*a^2 c Sqrt[f (a + c)] - ...)
   ]
$\endgroup$
1
  • $\begingroup$ Or a replacement rule. (final expression)/.{x->x0,y->y0,z->z0,...} $\endgroup$
    – evanb
    Commented Jan 12, 2016 at 2:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.