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

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

> 

diffx→x2,x

Error, non-algebraic expressions cannot be differentiated

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

> 

diffx2,x

2⁢x

(2.1)

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

> 

Dx→x2

x↦2⋅x

(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.

> 

v≔5 t+1,12−10t2+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.

> 

x≔r,t→r⋅sint

x:=r,t→r⁢sin⁡t

(2.5)
> 

y≔r,t→r⋅cost

y:=r,t→r⁢cos⁡t

(2.6)
> 

z≔r,t→r2⋅sint⋅cost

z:=r,t→r2⁢sin⁡t⁢cos⁡t

(2.7)
> 

R≔r,t→xr,t,yr,t,zr,t

R:=r,t→x⁡r,t,y⁡r,t,z⁡r,t

(2.8)
> 

Rr,t;

> 

r1≔diffRr,t,r

Error, non-algebraic expressions cannot be differentiated

> 

r2≔diffRr,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:

> 

x≔r,t→r⋅sint

x:=r,t→r⁢sin⁡t

(2.9)
> 

y≔r,t→r⋅cost

y:=r,t→r⁢cos⁡t

(2.10)
> 

z≔r,t→r2⋅sint⋅cost

z:=r,t→r2⁢sin⁡t⁢cos⁡t

(2.11)
> 

R≔r,t→xr,t,yr,t,zr,t

R:=r&comma;t&rarr;VectorCalculus:-<,>⁡x⁡r&comma;t&comma;y⁡r&comma;t&comma;z⁡r&comma;t

(2.12)
> 

Rr&comma;t&semi;

> 

r1≔diffRr&comma;t&comma;r

> 

r2≔diffRr&comma;t&comma;t

See Also

diff

D

operators/elementwise

type/algebraic

VectorCalculus[diff]