jayped007

90 Reputation

6 Badges

19 years, 287 days

MaplePrimes Activity


These are questions asked by jayped007

Hi,

I had an issue where I wanted the quotient of two integers a and b; the quotient q from the division algorithm for a/b which finds a = b*q + r, 0 <= r < b

I was not sure how to obtain it. Since,

a := 7;
b := 3;
q := a / b; # returns fraction 7/3

Received some help from G. A. Edgar from Ohio State and Joe Riel from Maple; who clued me into the use of 'iquo' to obtain this.

a := 7;
b := 3;
q := iquo(a,b,'r'); # q = 2, r = 1

I was experimenting with floor(a/b), but I am sure this is more efficient (no conversion between fraction and integer);

There is 'irem' which just determines the remainder from integer division. The 3rd argument in iquo is optional ... and returns the remainder from the division.
Page 1 of 1