Mathematica taking a long time to solve

  • Context: Mathematica 
  • Thread starter Thread starter haihek
  • Start date Start date
  • Tags Tags
    Mathematica Time
Click For Summary

Discussion Overview

The discussion revolves around the challenges faced when using Mathematica to solve a set of complicated simultaneous equations. Participants explore potential reasons for the long computation times and suggest various strategies to improve the solving process.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Exploratory

Main Points Raised

  • One participant reports that their attempt to solve two simultaneous equations has been running for over 6 hours without completion.
  • Another participant suggests solving for one variable in terms of the other and substituting it back into the original equation, which may simplify the problem.
  • A later reply mentions that the complexity of the equations could be affecting the run time and recommends reducing the size of the expressions to improve performance.
  • One participant proposes substituting a common term in the equations to simplify them, claiming it could significantly reduce the expression size without altering the results.
  • Another participant speculates that the solution may not have an analytic form or could be overly complex, suggesting that assigning assumptions about the variables might help speed up the computation.

Areas of Agreement / Disagreement

Participants express differing views on the potential causes of the long computation times and the effectiveness of the proposed strategies. No consensus is reached regarding the best approach to resolve the issue.

Contextual Notes

Participants mention the importance of assumptions regarding the variables, such as their positivity or boundedness, which may influence the solving process but do not resolve the underlying complexity of the equations.

haihek
Messages
3
Reaction score
0
Hi everyone,

I am trying to solve this complicated two simultaneous equations, and it has been taking more than 2 hours to solve .. and it is still running... can anyone tell me what is wrong .. thanks

Solve[{((((1 - xr)/xr)^(1/2) (M2^2 xr - 1)/(
1 + (gam + 1)/2 M2^2 - M2^2 xr)) - (((1 - xm)/xm)^(1/2) (
M1^2 xm - 1)/(1 + (gam + 1)/2 M1^2 - M1^2 xm)))/(
1 + (((1 - xr)/xr)^(1/2) (M2^2 xr - 1)/(
1 + (gam + 1)/2 M2^2 - M2^2 xr)) (((1 - xm)/xm)^(1/2) (
M1^2 xm - 1)/(1 + (gam + 1)/2 M1^2 - M1^2 xm))) == tanthi,
xm - a xr == b}, {xm, xr}]
 
Physics news on Phys.org
Try to solve xm in terms of xr from
xm - a xr == b
then place it in the other equation, then solve just for xm.
It may do the job.
 
implicitnone said:
Try to solve xm in terms of xr from
xm - a xr == b
then place it in the other equation, then solve just for xm.
It may do the job.

Thank you for you reply, although it looked like it may do the job, but nope.. still facing the same waiting time. I don't know if it is normal to take that long (6 hours now), because i never faced this type of run before. Should i just keep it running? or is it a sign of calculation failure??
 
Disclaimer: This is somewhat user superstition.

It seems that when Solve is given "complicated equations" that the size of the expression has a serious effect on the run time. Doing what is possible to reduce the size of the expressions seems to help.

Notice that gam always appears as (gam + 1)/2 in your expression. Substituting using
expression/.(gam + 1)/2->g
will reduce the size and not change the results.

If I have not made any mistake then the smallest I have been able to make your expression is
(-(Sqrt[-1 + 1/xm]*(-1 + M1^2*xm)*(1 + M2^2*(g - xr))) + (1 + M1^2*(g -
xm))*Sqrt[-1 + 1/xr]*(-1 + M2^2*xr))/((1 + M1^2*(g - xm))*(1 + M2^2*(g -
xr)) - Sqrt[-1 + 1/xm]*(-1 + M1^2*xm)*Sqrt[-1 + 1/xr]*(-1 + M2^2*xr))

That is about 2/3 the size of your original and does not incorporate the other
suggestion of substituting for one of the xm or xr.
 
Its a sign of the solution probably having no analytic form, or at least a really crazy one.
It helps to assign some assumptions sometimes, especially when sqrts are involved. Are the M's or xm's or a/b positive? real? less than/gt one? These things can help speed things up:

$Assumptions = b>0&&a>0&&0<=xm<=1

etc.
 
thank you guys for your replies
 

Similar threads

  • · Replies 19 ·
Replies
19
Views
3K
Replies
4
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K