non-algebraic expressions cannot be differentiated - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Error Message Guide : non-algebraic expressions cannot be differentiated

Error, non-algebraic expressions cannot be differentiated

 

Description

Examples

Description

This error occurs when an argument that is not of type algebraic is passed to the diff command.

Examples

Example 1

In

diffxx2,x

Error, non-algebraic expressions cannot be differentiated

Solution 1: Use an expression, not function, for the first argument:

diffx2,x

2x

(2.1)

Solution 2: The differential operator D can differentiate procedures (including functional operators).  

Dxx2

x2x

(2.2)

 

For users of Maple 2017 and earlier versions:  Previously, this error was generated in the following cases.  As a result of updates made in Maple 2018, these examples no longer result in an error.

Example 2

In the following example, an error is generated when a Vector, v, is passed to the diff command.

v5 t+1,1210t2+50

v:=5t+15t2+50

(2.3)

diffv,t

Error, non-algebraic expressions cannot be differentiated

This is as expected since v is not of type algebraic.

typev,algebraic

false

(2.4)


Solution:

Here, we assume that the intention was to differentiate each element of the Vector.  Since each element in the Vector is an algebraic expression, differentiating element-wise corrects the above error.  Specifically, use ~ to differentiate each element of the Vector.  For more information on ~, see the operators/elementwise help page.

diff~v,t

510t

(2.5)

typev1,algebraic,typev2,algebraic

true,true

(2.6)


Example 3

In the following example, the call to the VectorCalculus package has been omitted.  This results in the top-level diff function being used for the right-hand side values of r1 and r2, rather than VectorCalculus[diff].  Since the top-level diff function does not accept Vectors as arguments, an error occurs.

xr,trsint

x:=r,t→rsint

(2.7)

yr,trcost

y:=r,t→rcost

(2.8)

zr,tr2sintcost

z:=r,t→r2sintcost

(2.9)

Rr,txr,t,yr,t,zr,t

R:=r,t→xr,t,yr,t,zr,t

(2.10)

Rr,t;

rsintrcostr2sintcost

(2.11)

r1diffRr,t,r

Error, non-algebraic expressions cannot be differentiated

r2diffRr,t,t

Error, non-algebraic expressions cannot be differentiated


Solution:

Adding with(VectorCalculus) before the sequence of statements results in VectorCalculus[diff]. This corrects the error.

withVectorCalculus:

xr,trsint

x:=r,t→rsint

(2.12)

yr,trcost

y:=r,t→rcost

(2.13)

zr,tr2sintcost

z:=r,t→r2sintcost

(2.14)

Rr,txr,t,yr,t,zr,t

R:=r&comma;t&rarr;VectorCalculus:-<,>xr&comma;t&comma;yr&comma;t&comma;zr&comma;t

(2.15)

Rr&comma;t&semi;

rsintex&plus;rcostey&plus;r2sintcostez

(2.16)

r1diffRr&comma;t&comma;r

r1:=sintex&plus;costey&plus;2rsintcostez

(2.17)

r2diffRr&comma;t&comma;t

r2:=rcostexrsintey&plus;r2cost2r2sint2ez

(2.18)

See Also

diff

D

operators/elementwise

type/algebraic

VectorCalculus[diff]