4

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!

  • 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. – bbgodfrey Aug 14 '15 at 19:34
  • 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? – MarcoB Aug 14 '15 at 19:51
  • @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} – Blaz Stojanovic Aug 14 '15 at 20:37
  • Blaz, I'm confused. The code in your comment is not syntactically correct, nor does it work if I try to fix it as best I can. For example = is Set, the equal sign is ==; ax is the name of a single variable, whereas a x is a*x, which I think is what you mean. That can't be the code you used! Have you tried pasting it it into Mathematica and running it? – MarcoB Aug 14 '15 at 20:47
  • @MarcoB Well yes, when you asked for the code I just copied it from the mathematica window. I'm confused as well, how come if the code is wrong Mathematica still interpreted it correctly?

    Yeah when I wrote ax I actually meant a*x. As x,y,z,q are the variables and a,b,c,d,e,f are the parameters

    – Blaz Stojanovic Aug 14 '15 at 20:57
  • Blaz, I'm not sure what to say, but the code in your comment simply can't run as is. The following works to produce a solution: 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} ]

    However, I don't know how you obtained results including approximate numbers in your posted solution for $x$, since all numbers are expressed in arbitrary precision. I suspect that something is still unclear here. I would strongly suggest that you edit your question to show complete and correct code to start.

    – MarcoB Aug 14 '15 at 21:08
  • @MarcoB Sure, will do. Maybe the way I am asking the question is weird. Is there a place for beginners to learn how to use Mathematica properly. Maybe If I read through it I could help myself. – Blaz Stojanovic Aug 14 '15 at 21:14
  • 5
    I just want to comment that your "poor English" is better than far too many native speakers/writers... – ciao Aug 14 '15 at 21:16
  • 3
    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. – MarcoB Aug 14 '15 at 21:46

1 Answers1

2

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)] - ...)
   ]
Jack LaVigne
  • 14,462
  • 2
  • 25
  • 37