Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'add 1 to an Interpolating Function?' topicStudent Support Forum > General > "add 1 to an Interpolating Function?"

Next Comment >Help | Reply To Topic
Author Comment/Response
Charlie Brummitt
06/27/06 11:56am

I would like to be able to add 1 (or any other number) to an interpolating function and then set that interpolating function to that new function. For example, I'd like to do something like this:

(* suppose 'solution' is an interpolating function generated by NDSolve *)

solution = solution + 1;

Is there a way to do this? The reason I want to do this is because I am trying to write code for calculating the Lyapunov exponent in order to test PDE's for chaos. I want to "perturb" the solution (which is an interpolating function) at every timestep as NDSolve solves the PDE.

Here's what I'm trying to do:
First, I solve the PDE, and I call this the unperturbed solution. Then I solve it again but with a tiny perturbation. Rather than doing just one perturbation at the beginning, I do a perturbation at each timestep but keep bringing the perturbed solution "back" to the unperturbed solution. In other words, at each timestep in the evolution of NDSolve, I reset the perturbed solution to where the unperturbed solution is, and then I perturb it slightly. (The reason I do this is because I don't want the two solutions to spread further and further apart. This way I can calculate the degree to which nearby intial conditions spread apart and keep re-orienting the perturbed solution to where the unperturbed solution is.)

Essentially, what I want to do when I solve the perturbed solution is to have a step monitor that does the following:

StepMonitor :>

(*code to store the local lyapunov exponent, already written and working*);
AppendTo[listOfExponents, Log[Abs[u[pos, t] - unperturbedSolution[pos,
t]]/?R]];

(*now the troublesome part: reset the perturbed solution back to where the unperturbed solution is at this point in time t but then perturb it by ?R *)

(*this is the code I want to be able to write, but it doesn't seem to work *)
u[x, t] = unperturbedSolution[x, t] + ?R;

(*note: the unperturbedSolution has already been solved previously, so I have that solution - an interpolating function - at my disposal. *)


Essentially, how can I set an interpolating function to another interpolating function + some number (like .00000001)?

I tried making a new interpolating function from data generated using the old interpolating function:

u[x, t] = Interpolation[Table[?R + unperturbedSolution[x, t],{x, 0, length, 1}]]

...but this didn't seem to work either. Plus, it would be slow if it did.

Is there any way to do this? If someone could give me some help I would greatly appreciate it.

URL: ,

Subject (listing for 'add 1 to an Interpolating Function?')
Author Date Posted
add 1 to an Interpolating Function? Charlie Brum... 06/27/06 11:56am
Re: add 1 to an Interpolating Function? Vl 06/27/06 8:59pm
Re: add 1 to an Interpolating Function? Chaos 06/28/06 03:15am
Next Comment >Help | Reply To Topic