Subject: Fwd: What am I doing wrong with this cycle?
From: Raymond Toy
Date: Thu, 18 Jul 2013 11:29:25 -0700
Forwarding Pyotr message to the list
---------- Forwarded message ----------
From: Pyotr Ivanshin <pivanshin at gmail.com>
Date: Thu, Jul 18, 2013 at 9:01 AM
Subject: Re: [Maxima] What am I doing wrong with this cycle?
To: Raymond Toy <toy.raymond at gmail.com>
Thank you for the answer.
Well, the thing is k is integer. So the result must be polynomial on t and
z.
The main idea is to read a string letter by letter and to successfully
apply different operations (according to the letter read) to polynomials on
z and t.
For any k we must have on the first iteration (j=1) after reading "d"
f[1](z, t)=-4*5*(rw5*z^(k+1)*t/(k+1)+rw5*t^(k+1)*z/(k+1))
For k=1
(we read the first letter-d):
f[1](z, t)=-4*5*(rw5*z^2*t/2+rw5*t^2*z/2)
(we read the second letter-d):
f[2](z,t)=2*3*4*5(rw5*z^3*t^2/12+rw5*t^3*z^2/12)
(we read the third letter -c):
f[3](z,t)=(-1/2)*2*3*4*5(rw5*z^4*t^2/48+rw5*t^3*z^3/36)
2013/7/18 Raymond Toy <toy.raymond at gmail.com>
> >>>>> "Pyotr" == Pyotr Ivanshin <pivanshin at gmail.com> writes:
>
> Pyotr> The output of this program is simply wrong.
> Pyotr> f[0](z,t):=rw5*z^k+rw5*t^k;
> Pyotr> S:"ddc";
> Pyotr> M[0]:5;
> Pyotr> for j:1 thru slength(S) step 1 do (if charat(S, j)="a" then
> Pyotr> (M[j]:M[j-1]-2, h[j](z,t):=(M[j]
> Pyotr> +1)*(M[j]+2)*integrate(f[j-1](z,t), t)/2, f[j](z,
> Pyotr> t):=-(1/4)*integrate(h[j](z, t)
> Pyotr> -h[j](t,
> Pyotr> z), z))
> Pyotr> elseif charat(S, j)="b" then (M[j]:M[j-1]-2, h[j](z,t):=Mu*(M[j]
> Pyotr> +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)
> Pyotr> elseif charat(S, j)="c" then (M[j]:M[j-1]-1, f[j](z,
> Pyotr> t):=(-1/2)*(M[j]+1)*integrate(f[j
> Pyotr> -1](z,t), z))
> Pyotr> elseif charat(S, j)="d" then (M[j]:M[j-1]-2, f[j](z,
> Pyotr> t):=-(M[j]+1)*(M[j]+2)*integrate(integrate(f[j
> Pyotr> -1](z,t), z), t))
> Pyotr> elseif charat(S, j)="e" then (M[j]:M[j-1]-1, f[j](z,
> Pyotr> t):=-Mu*(M[j]+1)*f[j-1](z, t))
> Pyotr> elseif charat(S, j)="f" then (M[j]:M[j-1]-1, f[j](z,
> Pyotr> t):=(M[j]+1)*integrate(integrate(f[j
> Pyotr> -1](z,t), z), t)/Mu)
> Pyotr> );
>
> Pyotr> Even f[1] (z, t) equals wrong expression.
>
>
> Pyotr> Would anybody be so kind as to show me my mistake?
>
> It would probably a lot more helpful if you actually explained what
> this is computing and what the expected answer should be and why you
> think it's wrong.
>
> Ray, who didn't even try the code :-(
>
>
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>