Re: How to find one expression in terms of another expression?
- To: mathgroup at smc.vnet.net
- Subject: [mg119741] Re: How to find one expression in terms of another expression?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Mon, 20 Jun 2011 08:04:23 -0400 (EDT)
On 6/19/11 at 7:29 PM, walkeystalkey at gmail.com (Jacare Omoplata) wrote: >I want to find dT in terms of dt. They are given below. >In[1]:= Element[{x1, x2, t1, t2, u, c}, Reals] >Out[1]= (x1 | x2 | t1 | t2 | u | c) \[Element] Reals The above isn't useful outside a list of assumptions. You cannot set global properties of variables in this manner. >In[3]:= T1 = (t1 - ((u x1)/c^2))/Sqrt[1 - (u^2/c^2)] >Out[3]= (t1 - (u x1)/c^2)/Sqrt[1 - u^2/c^2] >In[4]:= T2 = (t2 - ((u x2)/c^2))/Sqrt[1 - (u^2/c^2)] >Out[4]= (t2 - (u x2)/c^2)/Sqrt[1 - u^2/c^2] >In[5]:= dT = T2 - T1 >Out[5]= -((t1 - (u x1)/c^2)/Sqrt[1 - u^2/c^2]) + ( >t2 - (u x2)/c^2)/Sqrt[1 - u^2/c^2] >In[6]:= dt = t2 - t1 >Out[6]= -t1 + t2 This is what is causing the error message when you use Solve >If I knew that dT can be written in terms of dt in the form, dT = a >dt + b, Can I use Mathematica to find a and b? Yes, >I tried using Solve[dT == a dt + b, dt], but that gives an error. The problem here is you have already given dt a value. And it is that value that gets substituted in the equation you set up. That is your input to Solve is exactly equivalent to Solve[dT == a (t2-t1) + b, t2-t1] Since t2-t1 is clearly not a variable you get the error message. A couple of things can be done. Use Block to localize dt, i.e., In[9]:= Block[{dt}, Solve[dT == a dt + b, dt]] Out[9]= {{dt -> (-(b*c^2*Sqrt[(c^2 - u^2)/c^2]) + c^2*(-t1) + c^2*t2 + u*x1 - u*x2)/(a*c^2*Sqrt[(c^2 - u^2)/c^2])}} Clear the definition of dt and use Solve as you did above. But I suspect neither of these will give you the result you are looking for. I think you want something like In[12]:= expr=Together[dT] /. t2 -> dt + t1 // Simplify Out[12]= (c^2*dt + u*(x1 - x2))/(c^2*Sqrt[1 - u^2/c^2]) In[13]:= CoefficientList[expr, dt] Out[13]= {(u*(x1 - x2))/(c^2*Sqrt[1 - u^2/c^2]), 1/Sqrt[1 - u^2/c^2]}