p
and q
in one polynomial and
remainder is calculated using divide(p,q)
. If the polynomials
have more than one variable, an optional variable can be specified,
which will be used for division. gcd(p,q)
returns the greatest common denominator
of two expressions. Both functions also work with numbers as arguments.
>> divide(122344,7623) ans = [ 16 376 ] >> divide(2+i,3+2*i) ans = [ 1/2 1/2 ] >> syms x,z >> divide(x^3*z-1,x*z-x,x) ans = [ x^2*z/(z-1) -1 ] >> divide(x^3*z-1,x*z-x,z) ans = [ x^2 x^3-1 ] >> gcd(32897397,24552502) ans = 377 >> gcd(z*x^5-z,x^2-2*x+1) ans = x-1