Hi, All, I am calculating the staircase fraction ...............................1 ..........f(n) = 1 + ------------- .................................1 .......................2 + --------- ...................................1 ...........................3 + ----- ................................4 + x ........................................x ............................................x ................................................n (I have to use the dots to fill the space, all below input format deblank the front space) I have no idea on how to write a loop to calculate this.

Hi, All,
Please look at this example. I am using Newton's method to solve for the equation x^2-a=0.
> restart:
> Digits := 30:
> f :=x-> x^2-a:
> df :=x-> 2*x:
> for a from 1 to 6 do
> x0 := trunc(sqrt(a)):
> for j from 1 to 5 do
> x1 := x0 - f(x0)/df(x0);
> x0 := x1;
> rsd := f(x0);
> end:
> printf(`%3.10f\t %3.10e\n`, x0,rsd):
> end:
Now, I want to plot the solution x and the residue rsd against a in 2 separate figures, how to write the code?
David

Dear All,
First of all thank alec and Prof Doug. Please refer to post http://beta.mapleprimes.com/node/362#comment-729
My problem is to solve the following ODE with constrain given by the Eq:
> DEq := diff(f(x),x) = c1*sqrt( g(f(x)) - g(f(x=x1)) );
> Eq := ug - f(x=0) = c2*sqrt( g(f(x=0)) - g(f(x=x1)) );
> g(f(x)) := exp(f(x)-xn) +exp(-f(x)) +(1-exp(-xn))*f(x);
where ug is the independent variable and others are parameters
> c1 :=-257753830.552993398770016153893;
> c2 :=1.40376701562707174099362643812;
> xn := 35.4196679725860384893589519100;
> x0 := 0;
> ug := 40;
I have tried to followed alec's suggestion but the solution sometime still cannot be obtained. The independent variable ug has to be varied from -50 or less to + 100 or more. The intial guess in solving f0 (f0 := fsolve(g('fx0'(f0))-gfx0(f0),f0=30);) has to be input manually, this is a big drawback.

Hi, All,
I am trying to solve numerically an ordernary differential equation like this
diff(y(x),x) = f(y(x),ya,x) (where ya = y(x=xa), xa a known value)
g(y(x=0),ya)=0
The trouble is that the initial value y(x=0) is determined by the second equation which is an implicit equation that has no analytical solution (no explicit expression), and it also depends on the solution at x=xa.
Kindly let me know how to write the code to solve it!
Thanks.
David

Hi, All,
I'm a Maple primer. I want to solve an ODE numerically and then save the data to file.
I use:
dsol := dsolve({deq,ic}, numeric, range=0..100);
or
dsol := dsolve({deq,ic}, numeric, range=0..100, output=operator);
then how can I print the formated data for some specified t (=1..100, for example) to a data file?
Thanks.
David