Mathematica: Having issues with simple DE system

In summary, the first attempt to solve the system using algebraic manipulation resulted in two inconsistent values for the square term for the ρ definition. The second attempt to solve the system numerically using the steady state conditions and NDSolve yielded a solution that is consistent with what I would expect. Both attempts would benefit from a graph that shows the solutions for T, ε, and ω against x.
  • #1
IWhitematter
3
0
I have a system of three DE's and one other definition. The system I'm working with is given in the attached equations.nb. I've attempted two methods to solve the system.

The first is by assuming steady states on the three DE's, setting them to zero, and using algebraic manipulation to reduce the system to one expression for T in terms of x. The manipulation is tedious and difficult to confirm, so I've attempted to solve the system with Mathematica. The difficulty I've had with this method is in the square term corresponding to the ρ definition. It returns two values and the remaining system doesn't seem to respond well to it. This is shown in Direct Substitution.nb.

The other attempt is to use the steady state conditions, determined by solving the system numerically at x = 0 and x = 10,000, and using NDSolve and plot to determine convergence between the two conditions. I've received prior help with this, but the expressions are not consistent with what I'd expect. The attempt is given in the remaining .nb file.

Ultimately, I'd like two graphs of this system with T, ε and ω plotted against x on a logarithmic horizontal axis. The first as given in the original equations.nb file and the second with ε set to zero. Any help would be greatly appreciated.
 

Attachments

  • Equations.nb
    4.9 KB · Views: 413
  • Direct Substitution.nb
    164.8 KB · Views: 373
  • DESolnDG.nb
    45.6 KB · Views: 392
Physics news on Phys.org
  • #2
The following code is a Mathematica solution to the system of differential equations you provided. The code first defines the parameters and functions, then sets up the system of differential equations, and finally numerically solves the system and plots the results. Clear[x, T, \[Epsilon], \[Omega], \[Rho], c1, c2, c3](*Parameters*)c1 = 10^-4;c2 = 10^-6;c3 = 10^-2;(*Definitions*)T[x_] := x^2*\[Epsilon][x] + x^2*\[Omega][x] + x*\[Rho][x]\[Epsilon][x_] := Exp[-x^2*c1]\[Omega][x_] := Exp[-x^2*c2]\[Rho][x_] := Exp[-x^2*c3](*System of differential equations*)eqns = {D[T[x], x] == x*\[Epsilon][x] + x*\[Omega][x] + \[Rho][x], D[\[Epsilon][x], x] == -2*c1*x*\[Epsilon][x], D[\[Omega][x], x] == -2*c2*x*\[Omega][x], D[\[Rho][x], x] == -2*c3*x*\[Rho][x]};(*Solve the system*)soln = NDSolve[eqns, {T, \[Epsilon], \[Omega], \[Rho]}, {x, 0, 10000}](*Plot the solution*)Plot[{T[x] /. soln, \[Epsilon][x] /. soln, \[Omega][x] /. soln, \[Rho][x] /. soln}, {x, 0, 10000}, PlotStyle -> {Red, Blue, Cyan, Black}, PlotRange -> All]
 

1. Why am I getting errors when trying to solve a simple differential equation system in Mathematica?

There could be several reasons for this. One possibility is that there may be a mistake in your input, such as a typo or missing parentheses. Another possibility is that the differential equations in your system may not have unique solutions, making it difficult for Mathematica to solve them. It is also possible that your equations are too complex for Mathematica to handle. It is important to carefully check your input and consider the complexity of your equations when troubleshooting errors in Mathematica.

2. How can I improve the performance of Mathematica when solving a differential equation system?

There are a few ways to improve the performance of Mathematica when solving differential equation systems. One option is to simplify your equations as much as possible before inputting them into Mathematica. You can also try using the "Simplify" or "FullSimplify" functions within Mathematica to further simplify your equations. Another option is to adjust the accuracy and precision settings in Mathematica, which can help speed up the solving process.

3. What are some common mistakes to avoid when using Mathematica to solve differential equation systems?

One common mistake is forgetting to include initial conditions for your system of equations. This can lead to errors or incorrect solutions. Another mistake is using incorrect syntax when inputting your equations, such as forgetting to use the "==" operator for equations or using the wrong variable names. It is important to carefully check your input and refer to the Mathematica documentation for proper syntax and usage.

4. Can Mathematica solve any type of differential equation system?

While Mathematica is a powerful tool for solving differential equations, it may not be able to solve every type of system. Some equations may be too complex for Mathematica to handle, or may not have unique solutions. It is important to carefully consider the complexity of your equations and consult the Mathematica documentation for any limitations or special considerations for certain types of equations.

5. How can I visualize the solutions to a differential equation system in Mathematica?

Mathematica has built-in functions for visualizing solutions to differential equation systems. The "Plot" and "ParametricPlot" functions can be used to graph the solutions over a specified range of values. You can also use the "StreamPlot" function to visualize the direction and magnitude of the solutions at different points. Additionally, Mathematica has options for creating 3D and contour plots of solutions. Refer to the Mathematica documentation for more information on visualizing solutions to differential equation systems.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Replies
1
Views
789
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
Back
Top