Error, non-algebraic expressions cannot be differentiated - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Error, 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

diffv,t

Error, non-algebraic expressions cannot be differentiated

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

typev,algebraic

false

(2.3)


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

typev1,algebraic,typev2,algebraic

true,true

(2.4)


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.5)

yr,trcost

y:=r,t→rcost

(2.6)

zr,tr2sintcost

z:=r,t→r2sintcost

(2.7)

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

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

(2.8)

Rr,t;

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.9)

yr,trcost

y:=r,t→rcost

(2.10)

zr,tr2sintcost

z:=r,t→r2sintcost

(2.11)

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.12)

Rr&comma;t&semi;

r1diffRr&comma;t&comma;r

r2diffRr&comma;t&comma;t

See Also

diff

D

operators/elementwise

type/algebraic

VectorCalculus[diff]