## Name:

div Computes the euclidian division of polynomials or numbers and returns the quotient

## Library name:

sollya_obj_t sollya_lib_euclidian_div(sollya_obj_t, sollya_obj_t)

## Usage:

div(a, b) : (function, function) -> function

## Parameters:

• a is a polynomial.
• b is a polynomial.

## Description:

• When both a and b are constants, div(a,b) computes the largest integer less than or equal to a divided by b. In other words, it returns the quotient of the Euclidian division of a by b.
• When at least one of a or b is a polynomial of degree at least 1, div(a,b) computes two polynomials q and r such that a is equal to the product of q and b plus r. The polynomial r is of least degree possible. The div command returns q. In order to recover r, use the mod command.
• When at least one of a or b is a function that is no polynomial, div(a,b) returns 0.

## Example 1:

> div(1001, 231);
4
> div(13, 17);
0
> div(-14, 15);
-1
> div(-213, -5);
42
> div(23/13, 11/17);
2
> div(exp(13),-sin(17));
460177

## Example 2:

> div(24 + 68 * x + 74 * x^2 + 39 * x^3 + 10 * x^4 + x^5, 4 + 4 * x + x^2);
6 + x * (11 + x * (6 + x))
> div(24 + 68 * x + 74 * x^2 + 39 * x^3 + 10 * x^4 + x^5, 2 * x^3);
19.5 + x * (5 + x * 0.5)
> div(x^2, x^3);
0

## Example 3:

> div(exp(x), x^2);
0