about solve_rec



Hello,

thanks for bringing this to our attention. I will commit your fix to
cvs and it will be available in next release.

Andrej

On 9/27/06, laurent couraud <l.couraud at free.fr> wrote:
> Hello all,
>
> I noted that solve_rec does not work when the expression contains
> a subscripted variable whose index is purely numerical.
>
> Example: solve_rec(u[k] = u[k-1] + u[0], u[k]);
>
> Give the error message:
>
> If 4 arguments are given to MAKELIST, the difference of the 3rd
> and 4th arguments should evaluate to a non-negative integer:
> errexp1
> #0:
> solve_rec_gen(std_form=shift_op(u,k,-min(-k,-1))-shift_op(u,k,-min(-k,-1)-k)-shift_op(u,k,-min(
> -k,-1)-1),%f=u,%n=k,cond=[])(solve_rec.mac line 212)
> #1: solve_rec(eq=u[k] = u[k-1]+u[0],fn=u[k],cond=[])(solve_rec.mac line 178)
> an error.  Quitting.  To debug this try debugmode(true);
>
>
> It seems that it is possible to correct the problem by adding only one line in the function:
> change_to_shift_op
>
> The line that I added is:
>
> If numberp(first(k%)) then return(expr),
>
> The corresponding version of the function is:
>
> change_to_shift_op(expr, %f, %n) :=
>   if atom(expr) then expr
>   else if part(expr, 0)=%f then block(
>     [k% : args(expr)],
>     if numberp(first(k%)) then return(expr),
>     funmake('shift_op, [%f, %n, k%[1]-%n])
>   )
>   else if member(part(expr, 0), ["+", "*", "//", "^", "-"]) then
>     apply(part(expr, 0),
>       map(lambda([%u], change_to_shift_op(%u, %f, %n)), args(expr)))
>   else expr$
>
>
> Is it correct?
>
> PS: sorry for my bad english I'm French.
>
> Laurent.
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>