Error: division by zero

In mathematics, division by zero is not allowed. In Maple, an attempt to divide by zero produces this error.

> sin(0)/0;

Error, division by zero

In some cases when a division by zero results from evaluating some expression at a certain value of a variable x , what is really wanted instead is the limit of the expression as x approaches this value. This may be obtained by using limit .

> limit(sin(x)/x, x=0);

1

Sometimes a division by zero can result when Maple fails to recognize early enough that some quantity is 0.

> series(p/((1-sin(x-p)^2 - cos(x+p)^2)), p = 0,3);

series(1/(1-sin(x)^2-cos(x)^2)*p+4*sin(x)*cos(x)/((...
series(1/(1-sin(x)^2-cos(x)^2)*p+4*sin(x)*cos(x)/((...

> simplify(%);

Error, (in simplify/trig) division by zero

When this occurs in series and related commands, you may be able to fix the problem by changing the environment variable Testzero , whose value is the procedure used in series to determine when the leading coefficient is 0. By default this uses Normalizer , another environment variable whose default value is normal .

> eval(Testzero);

proc (O) evalb(Normalizer(O) = 0) end proc

> evalb(eval(Normalizer)=eval(normal));

true

You can replace Normalizer by simplify to get a stronger test.

> Testzero:= proc(O) evalb(simplify(O)=0) end:

Since series has the remember option, if you try the same series command again it will just remember the value it computed before. To get it to try again, you can make it forget the past values.

> forget(series);

> series(p/((1-sin(x-p)^2 - cos(x+p)^2)), p = 0,3);

series(1/4*1/(sin(x)*cos(x))+O(p^2),p,2)

See also: limit , series , Testzero , Normalizer , normal , simplify , forget

Maple Advisor Database R. Israel, 2000