using 'depends' and 'assume' on arrays



On 7/5/07, Todd Hay <haymeister at gmail.com> wrote:
>
> However, sometimes I need to assume that the radius of a particular sphere
> doesn't change with time so that diff(R[i],t) = 0 for some particular value
> of i. I've tried to do this by using the 'assume' function:
>
> assume(equal(diff(R[i],t), 0))
>
> but this doesn't seem to work for further applications of 'diff', maxima
> still gives nonzero values for diff(R[i],t).


Well, in theory you should be able to do

            gradef(R[2](t),0)

but unfortunately Maxima doesn't allow subscripted variables in gradef --
this should probably be considered a bug.  And you also have to change your
notation to use R[i](t) everywhere instead of R[i].

A workaround is to use functions named R1, R2, etc. instead of R[1], R[2].
You can create these programmatically using concat(R,2) etc.  This is ugly
(I'm embarrassed), but should work. By the way, declaring R and X as arrays
doesn't do anything here; you can just leave those declarations out. As for
assume(equal(...)), Maxima never substitutes values based on the "assume"
database; it only uses them when an operation might depend on the
assumptions, e.g. assume(x<0)$ abs(x) => -x.

So your example would become:

N: 3$

velocityPotential(i):=
  block( [Ri: concat(R,i)(t),
          Xi: concat(X,i)(t) ],

         -Ri^2*diff(Ri, t)/r[i] - Ri^3*diff(Xi,t)/r[i]^2
       )$

gradef(R2(t),0)$
gradef(X3(t),0)$

Let us know how this works out.

             -s