Solving systems of nonlinear ordinary equations in Mathematica.

In summary: For example, if you know a and b are positive, you can add that assumption to your Solve command and it may help speed things up.
  • #1
fab333
4
0
I'm trying to solve a system of five nonlinear equations (degree 7) in Mathematica:

Code:
Solve[{q (a^2 + 
       b^2 (3 q^2 + r^2 + 8 t^2)) ((e - q)^2 - R^2 - 4 T^2)^2 + 
    q ((e - q)^2 + R^2 + 4 T^2) - 2 (e - q) (r R + 4 t T) == 0, 
  R (a^2 + b^2 (3 R^2 + (e - q)^2 + 8 T^2)) ((e - q)^2 - R^2 - 
        4 T^2)^2 + R (R (R - r) - (e - 3 q) (e - q) + 4 T (T - 2 T)) -
     r ((e - q)^2 + 4 T^2) == 0, 
  r (a^2 + b^2 (3 r^2 + q^2 + 8 t^2)) ((e - q)^2 - R^2 - 4 T^2)^2 - 
    r (R^2 + (e - q)^2 + 4 T ^2) + 2 R (q (e - q) - 4 t T) == 0, 
  T (a^2 + 2 b^2 (2 T^2 + (e - q)^2 + R^2)) ((e - q)^2 - R^2 - 
        4 T^2)^2 + T (4 T (T - t) - (e - 3 q) (e - q) + R (R - 2 r)) -
     t ((e - q)^2 + R^2) == 0, 
  t (a^2 + 2 b^2 (2 t^2 + q^2 + r^2)) ((e - q)^2 - R^2 - 4 T^2)^2 - 
    t (4 T^2 + (e - q)^2 - R ^2) + 2 T (q (e - q) - rR) == 0
  }, {q, r, t, R, T}]

but the program is running for an hour...
there is hope that it get to the end?

How do I have to change it to hope to arrive at the conclusion?

Thanks
 
Physics news on Phys.org
  • #2
If it isn't just a simple scrape and paste error then this worries me

) - rR) == 0

Perhaps you want a space between r and R there.

Sometimes when you have very complicated expressions you can make a simplification that can speed things up. For example, you have dozens of (e-q) in your equations. If you could substitute emq for (e-q) everywhere, patch the few isolated remaining q with (e-emq) and see whether this resulted in enough simplification then it might help speed things up.

I would also look for large common subexpressions and see whether you might be able to find a way to substantially simplify this before throwing it at Solve.

In general I would expect throwing 5 seventh order complicated multivariate polynomials at Solve to never finish in an acceptable time or with an acceptable result.
 
  • #3
Assumptions may help as well.
 

1. How do I input a system of nonlinear equations into Mathematica?

To input a system of nonlinear equations into Mathematica, you can use the command "Solve" followed by the list of equations separated by commas. For example, if you have the equations x^2+y^2=25 and x-y=3, the input would be "Solve[x^2+y^2==25, x-y==3]"

2. What if my system of equations has more than two variables?

If your system of equations has more than two variables, you can still use the "Solve" command in Mathematica. Simply list all of the equations separated by commas, and include all of the variables in the list of unknowns. For example, if you have the equations x^2+y^2+z^2=36, x-y=3, and y+z=7, the input would be "Solve[x^2+y^2+z^2==36, x-y==3, y+z==7, {x,y,z}]".

3. Can Mathematica solve systems of nonlinear equations with complex solutions?

Yes, Mathematica can solve systems of nonlinear equations with complex solutions. You can use the "Solve" command with the option "Complexes" to let Mathematica know that you are looking for complex solutions. For example, the input for solving the equations x^2+2x+5==0 and y^2+3y+4==0 for complex values would be "Solve[x^2+2x+5==0, y^2+3y+4==0, {x,y}, Complexes]".

4. What if my system of equations has no analytical solution?

If your system of equations has no analytical solution, Mathematica will return the input unchanged. This indicates that there is no exact solution and you may need to use numerical methods to approximate a solution.

5. How do I plot the solutions to a system of nonlinear equations in Mathematica?

To plot the solutions to a system of nonlinear equations in Mathematica, you can use the "ContourPlot" command. This will create a graph showing the curves where the equations intersect. For example, if you have the equations x^2+y^2=25 and x-y=3, the input for plotting the solutions would be "ContourPlot[{x^2+y^2==25, x-y==3}, {x,-10,10}, {y,-10,10}]".

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
262
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
1K
  • Introductory Physics Homework Help
Replies
17
Views
400
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
997
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
Replies
4
Views
438
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
41
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top