From: supergems on
I wrote a simple program for calculating the nth derivative:

\<< \-> F V N
\<< F XQ 1 N
FOR K V DERIV SIMPLIFY
NEXT
\>>
\>> 'DERVN' STO

'Function' 'Variable' 'N' --> nth derivative

Examples of use of DERVN program:

'1/\v/X' 'X' 3 --> '-(15*\v/X/(8*X^4))'
'\.S(-\oo,1/X,EXP(-Y^2),Y)' 'X' 2 --> '(2*X^2-2)/(X^5*EXP(1/X^2))'
'F(X,Y,Z)' 'Z' 2 --> 'd3d3F(X,Y,Z)'

If I apply my DERVN program this function:

'F(X,Y)=X*Y/(X^2+Y^2)' 'Y' 2 --> "Error: Invalid User Function"

Why am I getting that message?

If I delete 'SIMPLIFY' then get the correct result, obviously not
simplified:

\<< \-> F V N
\<< F XQ 1 N
FOR K V DERIV
NEXT
\>>
\>> 'DERVN' STO

'F(X,Y)=X*Y/(X^2+Y^2)' 'Y' 2 --> 'd2d2F(X,Y)=(SQ(X^2+Y^2)*(X*(2*Y)-(X*
(2*Y)+2*(X*Y)))-(X*(X^2+Y^2)-X*Y*(2*Y))*(2*((X^2+Y^2)*(2*Y))))/SQ(SQ
(X^2+Y^2))'

then SIMPLIFY: 'd2d2F(X,Y)=-((6*Y*X^3-2*Y^3*X)/
(X^6+3*Y^2*X^4+3*Y^4*X^2+Y^6))'

Cheers,
Simone.
From: Damir on
On Thu, 15 Oct 2009 07:47:27 -0700 (PDT), supergems
<simone.cerica(a)gmail.com> wrote:

>I wrote a simple program for calculating the nth derivative:
>
>\<< \-> F V N
> \<< F XQ 1 N
> FOR K V DERIV SIMPLIFY
> NEXT
> \>>
>\>> 'DERVN' STO
>
>'Function' 'Variable' 'N' --> nth derivative
>
>Examples of use of DERVN program:
>
>'1/\v/X' 'X' 3 --> '-(15*\v/X/(8*X^4))'
>'\.S(-\oo,1/X,EXP(-Y^2),Y)' 'X' 2 --> '(2*X^2-2)/(X^5*EXP(1/X^2))'
>'F(X,Y,Z)' 'Z' 2 --> 'd3d3F(X,Y,Z)'
>
>If I apply my DERVN program this function:
>
>'F(X,Y)=X*Y/(X^2+Y^2)' 'Y' 2 --> "Error: Invalid User Function"

'X*Y/(X^2+Y^2)' 'Y' 2 -->

>
>Why am I getting that message?
>
>If I delete 'SIMPLIFY' then get the correct result, obviously not
>simplified:
>
>\<< \-> F V N
> \<< F XQ 1 N
> FOR K V DERIV
> NEXT
> \>>
>\>> 'DERVN' STO
>
>'F(X,Y)=X*Y/(X^2+Y^2)' 'Y' 2 --> 'd2d2F(X,Y)=(SQ(X^2+Y^2)*(X*(2*Y)-(X*
>(2*Y)+2*(X*Y)))-(X*(X^2+Y^2)-X*Y*(2*Y))*(2*((X^2+Y^2)*(2*Y))))/SQ(SQ
>(X^2+Y^2))'
>
>then SIMPLIFY: 'd2d2F(X,Y)=-((6*Y*X^3-2*Y^3*X)/
>(X^6+3*Y^2*X^4+3*Y^4*X^2+Y^6))'
>
>Cheers,
>Simone.
From: supergems on
I don't understand why when I type an expression F (X, Y... )=... I
get an error message, while applying DERVN (with SIMPLIFY, without
SIMPLIFY no problem ) individually to members of that equation okay.
From: supergems on
I solved the problem by moving SIMP after NEXT :-) :

\<< \-> F V N
\<< F XQ 1 N
FOR K V DERIV
NEXT
\>> SIMPLIFY
\>> 'STO' DERVN

'F(X,Y)=X*Y/(X^2+Y^2)' 'Y' 2 --> 'd2d2F(X,Y)=-((6*Y*X^3-2*Y^3*X)/
(X^6+3*Y^2*X^4+3*Y^4*X^2+Y^6))'