Numerical solution in Mathematica

In summary, the conversation discusses a problem with finding numerical solutions using Mathematica for a system of ODE's containing functions computed using numerical methods. The user provides a simple example and explains that NDSolve works with a symbolic function but not with one computed using FindRoot. A solution is suggested through a question on voofie.com.
  • #1
FanOfGR
2
0
Hello,

I have a problem with numerical solution of the system of ODE's (geodesic eqs.) in Mathematica. The only relevant command I have found is NDSolve. It works perfectly, unless my equations contain functions which are again computed using numerical methods.

Simple example illustrating the problem.
Let's define function

F[x_] := Module[{}, FindRoot[ x y == 1, {y, 1/x} ][[1,2]] ];

I don't want to write F[x_] = 1/x, because I want Mathematica to compute it numerically. This function gives, of course, correct values, e.g. F[2]=0.5.

Now I want to solve equation y' = F with initial condition y(1)=0 using

sol = NDSolve[ {y'[x]== F[x], y[1]==0}, y, {x, 1, 3} ];

If I define F[x_] = 1/x, it works. If I define it by FindRoot, it doesn't. It seems to me that NDSolve tries to work with F[x] in symbolic form, but then FindRoot says, that 1/x is not a number.

I hope that I described the problem clearly. Please, if anybody knows the solution, tell me, I am getting crazy :)

Thank you
 
Physics news on Phys.org
  • #2
The main problem is that, Mathematica tries to solve your problem analytically first. So it plugs in symbolic x, and your function can't handle it.

Please refer to this question in http://www.voofie.com/concept/Mathematica/" :

http://www.voofie.com/content/163/ndsolve-in-mathematica-with-numerical-function/"

For ways to solve your problem.
 
Last edited by a moderator:

Related to Numerical solution in Mathematica

1. What is numerical solution in Mathematica?

Numerical solution in Mathematica refers to the process of using numerical methods to solve mathematical problems using the software Mathematica. It involves using algorithms and approximations to find numerical solutions to equations and systems of equations.

2. What types of problems can be solved using numerical solution in Mathematica?

Numerical solution in Mathematica can be used to solve a wide range of mathematical problems, including finding roots of equations, solving differential equations, and performing numerical integration and differentiation. It can also be used for data analysis and visualization.

3. How accurate is the numerical solution obtained from Mathematica?

The accuracy of the numerical solution obtained from Mathematica depends on the problem being solved and the methods used. Mathematica uses high-precision arithmetic and adaptive algorithms to ensure accurate results. However, it is important to check the accuracy and convergence of the solution for each specific problem.

4. Can Mathematica handle large-scale numerical problems?

Yes, Mathematica has powerful built-in functions and algorithms that allow it to handle large-scale numerical problems efficiently. It also has the ability to parallelize computations, making it suitable for solving complex problems on high-performance computing systems.

5. Do I need to have programming knowledge to use numerical solution in Mathematica?

While having some programming knowledge may be helpful, it is not necessary to use numerical solution in Mathematica. The software has a user-friendly interface and built-in functions that allow users to easily input equations and parameters and obtain numerical solutions without writing any code.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
546
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
323
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
496
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
954
Back
Top