fsolve and truncation error

Hello,
how can I display the truncation error when I run fsolve?
thank you

Answers (1)

Walter Roberson
Walter Roberson on 19 Jun 2012
fsolve() accepts arbitrarily complex functions. You cannot numerically calculate the truncation error of arbitrarily complex functions.
For example, suppose the function calculates the number of Odd Perfect Numbers, and suppose the solution come out with is 0. The truncation error would be the actual number of odd Perfect Numbers, a value that no one knows even though it has been actively studied for nearly 400 years. In order for fsolve() to return a (valid) truncation error, fsolve() would have to be able to solve a major outstanding problem in mathematical theory. No Can Do.

4 Comments

I understand...Hmm the problem is, fsolve should gives me solutions for a range of times t=0:10^-7:10; But this takes too long....I need a time step control, where only the timestep decreases when there is a large change between the solution x(t) and x(t+h)..I have no idea how to do this...
You can pass an options structure that includes a PlotFcns field that specifies @optimplotresnorm to visually plot the norm of the residuals, or @optimplotfval for the function value. This would give you an idea of "how well" the fitting is doing for any one fsolve() call. But I don't think it will really help.
fsolve() calls are independent. All they can measure is how well they are doing on fitting that _particular_ function, how close they are getting to 0 and how quickly it is converging for that _particular_ function. But fsolve() has no way of knowing how much the solution would change for x(t+h) because that is a _different_ function.
How messy is your function? Would it be practical to do a perturbation analysis on it, or to differentiate it with respect to t? Are you supplying jacobians?
My function is a strong nonlinear 10 dimensional vector field :) to differentiate it with respect to t is not an good idea...
I thought about counting the amount of iteration. When the number of iterations is greater than a upper threshold, the timestep is reduced by a factor of a. When the number of iterations is less then the lower threshold, the timestep is increased by a factor of c.
Or how works the stepcontrol in the ode() solvers ? This works pretty good...
Are you supplying jacobians? No but fsolve can easily return the jacobian...

Sign in to comment.

Categories

Find more on Mathematics in Help Center and File Exchange

Asked:

on 19 Jun 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!