differential



For ordinary variables:

     block( [ eq1, eq2, ...] , ...)

For arrays, function definitions, adding properties to symbols, etc.:

     block( [], local(arr,f,x,q ),
          arr[3] : 5,
          f(x) := x^2,
          assume(x<3),
          declare(q,integer)
                )


On Fri, Mar 22, 2013 at 4:53 PM, Thomas D. Dean <tomdean at speakeasy.org>wrote:

> On 03/22/13 11:46, Jaime Villate wrote:
>
>  depends(y,x);
>> eq1: a*x+b*y=p$
>> eq2: a^2+b^2=1$
>> eq3: diff (eq1,x)$
>> eq4: first (eliminate  ([eq1,eq2,eq3], [a,b]));
>> [edo1,edo2]: solve (eq4, diff(y,x));
>>
>> (%o7) ['diff(y,x,1) = (p*sqrt(y^2+x^2-p^2)+x*y)/(x^**2-p^2),
>>         'diff(y,x,1) = -(p*sqrt(y^2+x^2-p^2)-x*y)/(x^**2-p^2)]
>>
>>
> I think the solution must have a 'diff(y,x,2) term.
>
> I cannot get either solution back to the original equation...
>
> /* 9 circle tangent to the x axis */
> problem_1_4_9():=(
>   local(eq1,eq2,eq3,eq4,eq5,eq6,**eq7,eq8,eq9),
>   eq1:(x-h)^2+(y-k)^2=r^2,
>   eq2:subst(k=r,eq1),
>   depends(y,x),
>   eq3:first(expand(eliminate([**diff(eq2,x),diff(eq2,x,2)],[h,**r])/2))=0,
>   eq4:expand(eq3*2*'diff(y,x,2))**,
>   eq5:ode2(eq4,y,x),
>   eq6:eq5[1]^2,
>   eq7:subst(%k2=-h,eq6),
>   eq8:lhs(eq1)-rhs(eq1)=lhs(eq6)**-rhs(eq6),
>   eq9:subst(%k2=-h,eq8)+(x-h)^2,
>   print("Problem:  ",eq1),
>   print("Solution: ",eq4),
>   print("Check:    ",eq7)
>   )$
>
> eq1: a*x+b*y=p$
> eq2: a^2+b^2=1$
> eq3: diff (eq1,x)$
> eq4: first (eliminate  ([eq1,eq2,eq3], [a,b]));
> [edo1,edo2]: solve (eq4, diff(y,x));
>
>
> How do I define variables local to a function.  As above,
> problem_1_4_9();
>
> changes the value of eq1..eq4 defined outside the function...
>
> Tom Dean
> ______________________________**_________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/**mailman/listinfo/maxima<http://www.math.utexas.edu/mailman/listinfo/maxima>;
>