# Solve a system of equations and avoid calculations without response?

Posted 1 month ago
363 Views
|
8 Replies
|
5 Total Likes
|
 Hello. I am trying to solve a system of equations (actually, it seems to be solvable by hand, just a bit messy). Mathematica thinks for some time ("Running") and then just stops. With no answer. Has happened multiple times already with multiple systems. Is it common? Please find the system below: Simplify[Solve[ p1*a1*(-x0 + (e1b + e1l - x1)*a1)^(-2) + p2*a2*((e1b + e1l - x1)*a2)^(-2) == (w0l + x0*P00 - (e1b - x1)*P01)^(-2)*P01 && p1*(-x0 + (e1b + e1l - x1)*a1)^(-2) == (w0l + x0*P00 - (e1b - x1)*P01)^(-2)*P00, {x0, x1}]] Is there any way to resolve it? Thank you very much in advance.
8 Replies
Sort By:
Posted 1 month ago
 Dear Hans,Thank you for coding it! This is a nice and concise script, much better then what I usually do, so I learned something. It is strange that Mathematica did not go this way. Maybe it tries the solution that Claudio pointed out, which may lead to overload due to operations with quite messy objects... Anyways, thanks a lot once again!
Posted 1 month ago
 Thank you!! I will keep it in mind!
Posted 1 month ago
 The question is, why does Mathematica fail here. I do not think I am smarter then my computer after all... Good question - who knows?Following your proposal you are looking for this In[143]:= lsg = Solve[p1*a1*z1 + p2*a2*z2 == z3*P01 && p1*z1 == z3*P00, {z1, z2, z3}] // Flatten During evaluation of In[143]:= Solve::svars: Equations may not give solutions for all "solve" variables. >> Out[143]= {z2 -> -(((a1 P00 - P01) z3)/(a2 p2)), z1 -> (P00 z3)/p1} In[168]:= rr = {z1 -> (-x0 + (e1b + e1l - x1)*a1)^(-2), z2 -> ((e1b + e1l - x1)*a2)^(-2), z3 -> (w0l + x0*P00 - (e1b - x1)*P01)^(-2)}; In[150]:= t1 = z1/z3 /. lsg Out[150]= P00/p1 In[151]:= t2 = z2/z3 /. lsg Out[151]= -((a1 P00 - P01)/(a2 p2)) In[162]:= q1 = Sqrt[z1/z3] /. rr // PowerExpand Out[162]= (w0l + P00 x0 - P01 (e1b - x1))/(-x0 + a1 (e1b + e1l - x1)) In[164]:= q2 = Sqrt[z2/z3] /. rr // PowerExpand Out[164]= (w0l + P00 x0 - P01 (e1b - x1))/(a2 (e1b + e1l - x1)) In[165]:= lsg1 = Solve[{Sqrt[t1] == q1, Sqrt[t2] == q2}, {x0, x1}] // FullSimplify // Flatten Out[165]= {x0 -> -(((a1 Sqrt[P00/p1] - a2 Sqrt[(-a1 P00 + P01)/(a2 p2)]) (e1l P01 + w0l))/( a1 P00 Sqrt[P00/p1] - P01 Sqrt[P00/p1] - a2 (P00 + Sqrt[P00/p1]) Sqrt[(-a1 P00 + P01)/(a2 p2)])), x1 -> -(-P00 (e1b (P01 + a1 Sqrt[P00/p1]) + a1 e1l Sqrt[P00/p1] - w0l) + (P00 + Sqrt[P00/ p1]) (e1b (P01 + a2 Sqrt[(-a1 P00 + P01)/(a2 p2)]) + a2 e1l Sqrt[(-a1 P00 + P01)/(a2 p2)] - w0l))/(P00 (P01 + a1 Sqrt[P00/p1]) - (P00 + Sqrt[P00/p1]) (P01 + a2 Sqrt[(-a1 P00 + P01)/(a2 p2)]))} In[166]:= p1*a1*(-x0 + (e1b + e1l - x1)*a1)^(-2) + p2*a2*((e1b + e1l - x1)*a2)^(-2) == (w0l + x0*P00 - (e1b - x1)*P01)^(-2)*P01 /. lsg1 // FullSimplify Out[166]= True In[167]:= p1*(-x0 + (e1b + e1l - x1)*a1)^(-2) == (w0l + x0*P00 - (e1b - x1)*P01)^(-2)*P00 /. lsg1 // FullSimplify Out[167]= True 
Posted 1 month ago
 Dear Dmitry, yes, core power consumption and temperature strongly vary during a computation, at least on my system (Windows 10, Mathematica vs. 12) as my core temperature monitor program (freely downloaded from www.alcpu.com/CoreTemp/) tells me. I append a file that on my system causes thermal stop on a regular basis. I worked with such freely running manipulate programs for years (often over night just as you write) without encountering any thermal problem - until recently when they took me by surprise. I remember that I had problems with mysterious program stops may years ago. Here experts argued in favor of thermal problems but I had no monitoring program to verify this suspicion. In my present case of the problem it took me some time to remember these old problems that I thought to be due to old versions of Mathematica and old computers … Attachments:
Posted 1 month ago
 Dear Ulrich,Thank you very much for the comment! I think it is very possible. I was not aware of such a possibility. Actually, I sometimes leave the laptop overnight and it works fine, but sometimes (like in this case) it stops in some 15 minutes. Is it that some problems warm up the processor more then other?
Posted 1 month ago
 Dear Claudio, I still think it is solvable.  p1*a1*z1 + p2*a2*z2 == z3*P01 && p1*z1 == z3*P00 Above I denote the terms in brackets of the initial system as z1, z2 and z3 respectively. This linear system has a solution for z1/z3 and z2/z3, provided z3<>0. This solution will not contain x0 or x1 as arguments, they will be all inside z1/z3 and z2/z3. But then one can just invert the power (given that it is an integer and that the roots are non-negative). Then one can just solve the resulting system, which will be linear in x0 and x1, just a bit ugly.The question is, why does Mathematica fail here. I do not think I am smarter then my computer after all...
 I believe it's very unlikely that you could solve this system symbolically... I may be mistaken but see:If you take the equation 1 and solve for “x0” you have a very large solutions (which should be subsequently equated with the equation 2, also solved to “x0”, to then solve a definitive “x1” equation). Look at equation 1 solved for "x0": Solve[p1*a1*(-x0 + (e1b + e1l - x1)*a1)^(-2) + p2*a2*((e1b + e1l - x1)*a2)^(-2) == (w0l + x0*P00 - (e1b - x1)*P01)^(-2)*P01, {x0}] // InputForm If you observe this solution in Word with Arial font and size 9, you will see that it gives 119 pages only to the symbolic solution of equation 1 for "x0":Then you would still have to isolate the “x0” in equation 2 to match these solutions and solve an even more complex equation later...!You may solve this system if you have fewer variables and more numeric values in some (many) of the positions... At least that's what I believe...