On 07/18/2013 12:59 AM, Pyotr Ivanshin wrote:
> The output of this program is simply wrong.
>
> f[0](z,t):=rw5*z^k+rw5*t^k;
> S:"ddc";
> M[0]:5;
> for j:1 thru slength(S) step 1 do (if charat(S, j)="a" then
> (M[j]:M[j-1]-2, h[j](z,t):=(M[j]
> +1)*(M[j]+2)*integrate(f[j-1](z,t), t)/2, f[j](z,
> t):=-(1/4)*integrate(h[j](z, t)
> -h[j](t,
> z), z))
> elseif charat(S, j)="b" then (M[j]:M[j-1]-2, h[j](z,t):=Mu*(M[j]
> +1)*(M[j]+2)*integrate(f[j-1](z,t), t)/2, f[j](z, t):=(h[j](z,t)+h[j](t,z))/2)
> elseif charat(S, j)="c" then (M[j]:M[j-1]-1, f[j](z,
> t):=(-1/2)*(M[j]+1)*integrate(f[j
> -1](z,t), z))
> elseif charat(S, j)="d" then (M[j]:M[j-1]-2, f[j](z,
> t):=-(M[j]+1)*(M[j]+2)*integrate(integrate(f[j
> -1](z,t), z), t))
> elseif charat(S, j)="e" then (M[j]:M[j-1]-1, f[j](z,
> t):=-Mu*(M[j]+1)*f[j-1](z, t))
> elseif charat(S, j)="f" then (M[j]:M[j-1]-1, f[j](z,
> t):=(M[j]+1)*integrate(integrate(f[j
> -1](z,t), z), t)/Mu)
> );
>
> Even f[1] (z, t) equals wrong expression.
>
>
> Would anybody be so kind as to show me my mistake?
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
Hello Pyotr,
I looked at your code snippet and rearranged it on the comma boundaries
so it was more readable. I also
made a copy of S="abcdef" and placed a few ldisplay() commands in the
code, but then I noticed that k and Mu were not initialized. Here's what
I did in my attempt to run it.
/*In this code snipet, Mu & k don't seem to be initialized*/
f[0](z,t):=rw5*z^k+rw5*t^k;
/*S:"ddc";*/
S:"abcdef";
M[0]:5;
for j:1 thru slength(S) step 1 do (
if charat(S, j)="a" then
(M[j]:M[j-1]-2,
h[j](z,t):=(M[j]+1)*(M[j]+2)*integrate(f[j-1](z,t),t)/2,
f[j](z,t):=-(1/4)*integrate(h[j](z, t) -h[j](t,z), z),
ldisplay(M[j],M[j-1],h[j],f[j])
)
elseif charat(S, j)="b" then
(M[j]:M[j-1]-2,
h[j](z,t):=Mu*(M[j]+1)*(M[j]+2)*integrate(f[j-1](z,t), t)/2,
f[j](z, t):=(h[j](z,t)+h[j](t,z))/2,
ldisplay(M[j],M[j-1],h[j],f[j])
)
elseif charat(S, j)="c" then
(M[j]:M[j-1]-1,
f[j](z,t):=(-1/2)*(M[j]+1)*integrate(f[j-1](z,t), z),
ldisplay(M[j],M[j-1],f[j])
)
elseif charat(S, j)="d" then
(M[j]:M[j-1]-2,
f[j](z,t):=-(M[j]+1)*(M[j]+2)*integrate(integrate(f[j-1](z,t), z), t),
ldisplay(M[j],M[j-1],f[j])
)
elseif charat(S, j)="e" then
(M[j]:M[j-1]-1,
f[j](z,t):=-Mu*(M[j]+1)*f[j-1](z, t),
ldisplay(M[j],M[j-1],f[j])
)
elseif charat(S, j)="f" then
(M[j]:M[j-1]-1, f[j](z,t):=(M[j]+1)*integrate(integrate(f[j-1](z,t),
z), t)/Mu,
ldisplay(M[j],M[j-1],f[j])
)
);
I think you can go on from here once those variables are initialized and
maybe get some idea of what is happening as you run it by examining what
ldisplay() puts out.
I hope this might be usable,
Paul Bowyer