Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'How to copy the value of a variable' topicStudent Support Forum > General > Archives > "How to copy the value of a variable"

Next Comment >Help | Reply To Topic
Author Comment/Response
Ali
02/27/08 12:08pm

So I have a loop and everytime I calculate an interpolation function by numerical integration but this integration uses the value of the function in the former iteration and I am looking for a way to keep that for the next iteration step. For example:

f1[y_] := 1 - y;
For[sn = 0, sn < 10, sn++,
f0 = f1;
f1 = First[
f /. NDSolve[{f''[y]/(1 + (f'[y])^2)^1.5 ==
f0''[y]/(1 + (f0'[y])^2)^1.5 + 0.001, f[1] == f0[1],
f'[1] == f0'[1]}, f, {y, 0, 1}]];
]

But the problem is that when Mathematica is calculating f1 for the next iteration the value of f0 changes as well and I lose the information from the last iteration.

So I am basicly looking for a way to duplicate a function in which the target is independent of the source and if I change the source the target will stay intact.

Thanks in advance

URL: ,

Subject (listing for 'How to copy the value of a variable')
Author Date Posted
How to copy the value of a variable Ali 02/27/08 12:08pm
Re: How to copy the value of a variable Xavier 02/28/08 01:26am
Re: How to copy the value of a variable Ali 03/27/08 1:50pm
Re: Re: How to copy the value of a variable yehuda ben-s... 03/28/08 12:43pm
Next Comment >Help | Reply To Topic