# How can you know if a numerical solution is correct?

• I
• maughanster
In summary, the conversation discusses methods for determining the accuracy of a numerically solved nonlinear system of differential equations. The main approach mentioned is comparing the results with a "better" solution and using arbitrary precision arithmetic and Taylor Series Method to obtain higher order integration. Additionally, monitoring invariants and constants can also be helpful in assessing the accuracy of the solution.
maughanster
Hi PF,

Suppose I numerically solve a nonlinear system of differential equations. How can I know if my solution is correct (if there is no known analytic solution)? What are the standard practices people do? I have a couple of ideas, but I want to know what people are already doing.

Danke!

maughanster said:
I numerically solve a nonlinear system of differential equations.

you must specify in what sense because if it is a system of differential equation the solution is supposed to be a function ... what you mean when you said "I numerically solve a nonlinear system of ...'' ? There is an approximate solution (for example a polynomial ...)? Have you found an evalutation of the solution but not the complete analytic expression ? Another question: there are boundary condition for this system ?
Ssnow

I don't know a ton about these types of problems. Say I want to numerically itegrate a system of 4 nonlinear ODEs as an IVP. Or what if I have PDES as an IVP and do RK4 and finite differencing. Can I know if my numerical solution is correct? Assume I do not have an approximate solution (i.e. a polynomial)

The main method I currently use is to compare my answer with a "better" solution (example search term "Clean Numerical Simulation"). It sounds a bit obvious, but if you do another simulation with higher precision/order and smaller timestep, you can compare the results and see where they are diverging. This can be automated. I use arbitrary precision (MPFR) arithmetic for mitigating roundoff and because I trust INRIA more than I trust Intel to do floating point properly ;) I use the Taylor Series Method to obtain arbitrary order of integration.

Sometimes there are invariants and constants that you can evaluate and monitor. There are always local error estimates, but I tend to solve nonlinear ODEs that get rather degenerate or chaotic and these render local error irrelevant.

## 1. How do you check the accuracy of a numerical solution?

One way to check the accuracy of a numerical solution is by comparing it to an analytical solution, if one exists. This involves solving the same problem using an analytical method and then comparing the results to the numerical solution. If they are close, the numerical solution is likely accurate.

## 2. Can numerical solutions ever be completely accurate?

No, numerical solutions can never be completely accurate. This is because they involve rounding and approximations, which can introduce errors into the solution. However, the accuracy of a numerical solution can be improved by using more precise computational methods and increasing the number of iterations.

## 3. Is there a way to validate a numerical solution without an analytical solution?

Yes, there are other methods for validating a numerical solution without an analytical solution. One method is to use convergence analysis, which involves solving the problem with different grid sizes and comparing the results. If the results converge to a specific value as the grid size decreases, the numerical solution is likely accurate.

## 4. What is the role of error analysis in determining the correctness of a numerical solution?

Error analysis is an important tool for determining the correctness of a numerical solution. It involves quantifying the errors introduced by rounding and approximations in the solution process. By analyzing the errors, it is possible to determine the accuracy of the numerical solution and identify areas for improvement.

## 5. Can a numerical solution be considered correct if it satisfies the boundary conditions?

Not necessarily. While satisfying the boundary conditions is an important aspect of a numerical solution, it does not guarantee its correctness. Other factors, such as the accuracy of the numerical method and the convergence of the solution, must also be considered. Additionally, the boundary conditions themselves may not accurately represent the problem, leading to an inaccurate solution.

• General Discussion
Replies
1
Views
927
Replies
7
Views
963
• Programming and Computer Science
Replies
8
Views
1K
• Engineering and Comp Sci Homework Help
Replies
9
Views
1K
• Differential Equations
Replies
1
Views
1K
• Calculus
Replies
3
Views
1K
• Science and Math Textbooks
Replies
12
Views
913
• General Math
Replies
1
Views
2K
• General Math
Replies
4
Views
3K
• General Math
Replies
1
Views
1K