Hi, acer,
Yes, you misunderstood what I wrote. But from your suggestion I have worked out, it is
g := proc(n)
local f,F,i;
f := (t,n) -> n+1/t;
F := n;
for i from n-1 to 1 by -1 do
F := f(F,i);
od;
F;
end proc;
which is what I wanted. Use the function cfrac suggested by Tarr to verify:
a := g(9);
cfrac(a);
David

Hi, acer,
Yes, you misunderstood what I wrote. But from your suggestion I have worked out, it is
g := proc(n)
local f,F,i;
f := (t,n) -> n+1/t;
F := n;
for i from n-1 to 1 by -1 do
F := f(F,i);
od;
F;
end proc;
which is what I wanted. Use the function cfrac suggested by Tarr to verify:
a := g(9);
cfrac(a);
David

I see. Thanks a lot.
David

Prof. Douglas,
Thank you for your excellent explanation and code, esp. the two modifications in my code. I have tried it out.
BTW, when this line is included,
> with( plots ):
Maple returns a warning message
Warning, the name changecoords has been redefined
What does this mean? Another question is I did try to avoid using
df := 2*x;
by using
df := diff(f(x),x);
but it doesn't work, while yours
df := D(f);
works, why?
So it seems that in Maple plotting pairs of data is quite different from Matlab, in the latter it is much more simple, just plot(a,b).
David

Prof. Douglas,
Thank you for your excellent explanation and code, esp. the two modifications in my code. I have tried it out.
BTW, when this line is included,
> with( plots ):
Maple returns a warning message
Warning, the name changecoords has been redefined
What does this mean? Another question is I did try to avoid using
df := 2*x;
by using
df := diff(f(x),x);
but it doesn't work, while yours
df := D(f);
works, why?
So it seems that in Maple plotting pairs of data is quite different from Matlab, in the latter it is much more simple, just plot(a,b).
David

thank you, alec.
I agree the writing f(x=0) is not standard, I just want
exppress the function value of f when its independent
variable x=0, or x=x1. x1 is the same as x0 in the code,
just some given value of x.
In my code which I followed you did (below the =====
line) there is no x1.
If dverk78 method fails for my problem, you are suggesting
me to use other method like rkf45? Or any other methods
that I use. Maybe I should try it myself first.
David

thank you, alec.
I agree the writing f(x=0) is not standard, I just want
exppress the function value of f when its independent
variable x=0, or x=x1. x1 is the same as x0 in the code,
just some given value of x.
In my code which I followed you did (below the =====
line) there is no x1.
If dverk78 method fails for my problem, you are suggesting
me to use other method like rkf45? Or any other methods
that I use. Maybe I should try it myself first.
David

Yeah, I also got this trivial solution too. There is definitely other non-trivial solution, which I am looking for.

Yeah, I also got this trivial solution too. There is definitely other non-trivial solution, which I am looking for.

well, this is one of the solutions, but not the one
I am interested. I am trying to get the other nontrival
solution.

well, this is one of the solutions, but not the one
I am interested. I am trying to get the other nontrival
solution.

Thank alec and Doug.
For alec's suggestion, I tried to follow, but I could not get a solution for my problem, which is (to answer Doug's question)
DEq := diff(f(x),x) = c1*sqrt( g(f(x)) - g(f(x=x0)) );
Eq := ug - f(x=0) = c2*sqrt( g(f(x=0)) - g(f(x=x0)) );
where
g(f) := exp(f-xn) +exp(-f) +(1-exp(-xn))*f;
c1,c2,xn,ug are parameters, and x0 is some specific given value of x.
Actually, I am solving a Poisson equation which reads
DEq2 := diff(f(x),x$2) = c *( exp(f-xn) -exp(-f) +(1-exp(-xn)) );
constrains (mixed boundary conditions):
1. ug - f(x=0) = c2*sqrt( g(f(x=0)) - g(f(x=x0)) ); (g(f) defined above)
2. diff(f(x),x) = 0 when x=x0;
The above first-order DEq is just a first-integration of DEq2 with constrain 2.
alec or Doug, do you have any suggestion on the above problem? Thanks again for your time.
BTW, can you let me know how to post Maple workseet
contents as in Doug's lastet post?
David

Thank alec and Doug.
For alec's suggestion, I tried to follow, but I could not get a solution for my problem, which is (to answer Doug's question)
DEq := diff(f(x),x) = c1*sqrt( g(f(x)) - g(f(x=x0)) );
Eq := ug - f(x=0) = c2*sqrt( g(f(x=0)) - g(f(x=x0)) );
where
g(f) := exp(f-xn) +exp(-f) +(1-exp(-xn))*f;
c1,c2,xn,ug are parameters, and x0 is some specific given value of x.
Actually, I am solving a Poisson equation which reads
DEq2 := diff(f(x),x$2) = c *( exp(f-xn) -exp(-f) +(1-exp(-xn)) );
constrains (mixed boundary conditions):
1. ug - f(x=0) = c2*sqrt( g(f(x=0)) - g(f(x=x0)) ); (g(f) defined above)
2. diff(f(x),x) = 0 when x=x0;
The above first-order DEq is just a first-integration of DEq2 with constrain 2.
alec or Doug, do you have any suggestion on the above problem? Thanks again for your time.
BTW, can you let me know how to post Maple workseet
contents as in Doug's lastet post?
David

Thank you. I tried, it works.

Thank you. I tried, it works.