Sponsored links: Algebra eBooks
 

Related

quotient

z1:x^4+x^2+2*x-2;

z2:x^2-1;

quotient([eq1,eq2],[x...

Calculate

quotient-remainder

quotient(444,2);

remainder(444,2);

Calculate

quotient

z1:x^4+x^2+2*x-2;

z2:x^2-1;

quotient([z1,z2],[x,y]);

Calculate

quotient-remainder

quotient(x^5+x+1,x^3+2);

remainder(x^5+x+1, x^...

quotient(3*x^4-7*x,x-1);

Calculate

quotient-ratsimp-remainder

f : x^5 + 3*x^2 + x + 2;

g : x^2 + x + 1;

q1 : quotient(f, g);

Calculate

quotient-ratsimp-remainder

f : x^5 + 3*x^2 + x + 2;

g : x^2 + x + 1;

q1 : quotient(f, g);

Calculate

quotient-remainder

quotient(444,2);

remainder(444,2);

Calculate

quotient

z1:x^4+x^2+2*x-2;

z2:x^2-1;

quotient([eq1,eq2],[x...

Calculate

quotient-remainder

f : x^5 + 3*x^2 + x + 2;

g : x^2 + x + 1;

q1 : quotient(f, g);

Calculate

quotient

Run Example
(%i1)f : x^5 + 3*x^2 + x + 2;
                                5      2
(%o1)                          x  + 3 x  + x + 2
(%i2) g : x^2 + x + 1;
                                   2
(%o2)                             x  + x + 1
(%i3) quotient(f/g);
(%o3)                                  0
(%i4) 
Run Example
:lisp (defun enum-interval (low high &optional p)  (let* ((result nil)         (end-result 0))    (do* ((low low (+ low 1)))      ((>
 low high) (if (not p) end-result (values-list end-result)))      (setf end-result (reverse (push low result))))));

ENUM-INTERVAL
(%i1) :lisp (defun group (source n)  (if (zerop n) (error "zero length"))  (labels ((rec (source acc)             (let ((rest (nthcdr n source)))               (if (consp rest)                   (rec rest (cons (subseq source 0 n) acc))                   (nreverse (cons source acc))))))    (if source (rec source nil) nil)));

GROUP
(%i1) :lisp (defun row-sum (min max n)  (let ((list (enum-interval min max)) (result))    (values-list     (dotimes (i (length (group list n)) (values (nreverse result)))       (push        (list (mapcan (lambda (x) (if (numberp x) (list x)))              (nth i (group list n)))              (format nil "sum: ~a" (reduce '+         (mapcan (lambda (x) (if (numberp x) (list x)))        (nth i (group list n))))))        result)))));

ROW-SUM
(%i1) :lisp (defun col-sum (min max n)  (let ((list (enum-interval min max)) (result))    (values-list     (dotimes (i (1+ (length (group list n))) (values (nreverse result)))       (push        (list (mapcan (lambda (x) (if (numberp x) (list x))) (mapcar (lambda (x) (nth i x)) (group list n)))              (format nil "sum: ~a" (reduce '+ (mapcan (lambda (x) (if (numberp x) (list x))) (mapcar (lambda (x) (nth i x)) (group list n))))))        result)))));

COL-SUM
(%i1) :lisp (row-sum 0 10 5);

((0 1 2 3 4) sum: 10)
((5 6 7 8 9) sum: 35)
((10) sum: 10)
(%i1) :lisp (row-sum 0 10 2);

((0 1) sum: 1)
((2 3) sum: 5)
((4 5) sum: 9)
((6 7) sum: 13)
((8 9) sum: 17)
((10) sum: 10)
(%i1) :lisp (col-sum 0 10 5);

((0 5 10) sum: 15)
((1 6) sum: 7)
((2 7) sum: 9)
((3 8) sum: 11)
(%i1) :lisp (col-sum 0 10 2);

((0 2 4 6 8 10) sum: 30)
((1 3 5 7 9) sum: 25)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(%i1) :lisp (row-sum 0 10 11);

((0 1 2 3 4 5 6 7 8 9 10) sum: 55)
(%i1) :lisp (row-sum 1 10 10);

((1 2 3 4 5 6 7 8 9 10) sum: 55)
(%i1) :lisp (col-sum 0 10 1);

((0 1 2 3 4 5 6 7 8 9 10) sum: 55)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(%i1) :lisp (col-sum 1 10 1);

((1 2 3 4 5 6 7 8 9 10) sum: 55)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(NIL sum: 0)
(%i1) :lisp (defun accumulate (op init seq)  (if (null seq)      init      (funcall op (car seq)               (accumulate op init (cdr seq)))));

ACCUMULATE
(%i1) :lisp (defun horner-eval (x coeff-seq)  (accumulate (lambda (this-coeff higher-terms)                (+ (* higher-terms x) this-coeff))              0              (reverse coeff-seq)));

HORNER-EVAL
(%i1) :lisp (horner-eval 0 (list 3 2 1));

1
(%i1) f(x):=(3*(x^2))+(2*x)+1;
                                       2
(%o1)                       f(x) := 3 x  + 2 x + 1
(%i2) f(0);
(%o2)                                  1
(%i3) :lisp (horner-eval 2 (list 3 2 1));

17
(%i3) f(2);
(%o3)                                 17
(%i4) :lisp (defun entry (tree) (car tree))(defun left-branch (tree) (cadr tree))(defun right-branch (tree) (caddr tree))(defun make-tree (entry left right)  (list entry left right));

MAKE-TREE
(%i4) :lisp (defun element-of-set? (x set)  (cond ((null set) false)        ((= x (entry set)) true)        ((<
 x (entry set))         (element-of-set? x (left-branch set)))        ((>
 x (entry set))         (element-of-set? x (right-branch set)))));

ELEMENT-OF-SET?
(%i4) :lisp (defun adjoin-set (x set)  (cond ((null set) (make-tree x '() '()))        ((= x (entry set)) set)        ((<
 x (entry set))         (make-tree (entry set)                     (adjoin-set x (left-branch set))                    (right-branch set)))        ((>
 x (entry set))         (make-tree (entry set)                    (left-branch set)                    (adjoin-set x (right-branch set))))));

ADJOIN-SET
(%i4) :lisp (defun partial-tree (elts n)  (if (= n 0)      (cons '() elts)      (let ((left-size (quotient (- n 1) 2)))        (let ((left-result (partial-tree elts left-size)))          (let ((left-tree (car left-result))                (non-left-elts (cdr left-result))                (right-size (- n (+ left-size 1))))            (let ((this-entry (car non-left-elts))                  (right-result (partial-tree (cdr non-left-elts)                                              right-size)))              (let ((right-tree (car right-result))                    (remaining-elts (cdr right-result)))                (cons (make-tree this-entry left-tree right-tree)                      remaining-elts))))))));

PARTIAL-TREE
(%i4) :lisp (defun list->
tree (list)  (car (partial-tree list (length list))));

LIST->TREE
(%i4) :lisp (defun tree->
list (tree)  (if (null tree)      '()      (append (tree->
list (left-branch tree))              (cons (entry tree)                    (tree->
list (right-branch tree))))));

TREE->LIST
(%i4) :lisp (list->
tree '(1 3 5 7 9 11));

(5 (1 NIL (3 NIL NIL)) (9 (7 NIL NIL) (11 NIL NIL)))
(%i4) :lisp (tree->
list (list->
tree '(1 3 5 7 9 11)));

(1 3 5 7 9 11)
(%i4) 
Run Example
u:2*x^4+11*x^3+5*x^2-23*x^1+5;
                           4       3      2
(%o1)                   2 x  + 11 x  + 5 x  - 23 x + 5
(%i2) quotient: (u, (2*x^2+x-5));
                                    2
(%o2)                            2 x  + x - 5
(%i3) 
[append,block,col,do,equal,genmatrix,if,matrixmap,mod,quotient,transpose] [append,block,col,do,genmatrix,if,matrixmap,member,mod,quotient,transpose,true] [append,block,col,do,genmatrix,if,matrixmap,member,mod,quotient,transpose] [append,block,col,do,genmatrix,if,matrixmap,mod,quotient,transpose] [append,cons,if,let,quotient] [append,eval,false,if,labels,lambda,quotient,rest,reverse,sum,true] [apply,args,block,col,copymatrix,do,genmatrix,map,mod,quotient,return,transpose] [apply,args,block,copymatrix,do,genmatrix,map,mod,quotient,return,transpose] [apply,args,block,do,genmatrix,if,map,mod,quotient,return,transpose] [args,block,genmatrix,if,map,matrix,mod,quotient,transpose] [block,col,do,genmatrix,if,matrixmap,mod,quotient,transpose] [block,col,do,genmatrix,if,mod,quotient,return] [block,debugmode,endcons,length,makelist,quotient,random,rest,true] [block,do,genmatrix,if,map,matrix,mod,quotient,transpose] [block,do,genmatrix,if,map,mod,quotient,return,transpose] [block,do,genmatrix,if,map,mod,quotient,transpose] [block,do,genmatrix,mod,quotient,return,transpose] [block,do,genmatrix,mod,quotient,return] [block,endcons,length,makelist,quotient,random,rest] [block,endcons,length,makelist,quotient,rest] [block,endcons,length,quotient,rest] [block,genmatrix,if,map,matrix,mod,print,quotient,transpose] [block,genmatrix,mod,quotient,return] [coeff,factor,quotient,rat,remainder,resultant,subst] [divide,expand,quotient] [divide,factor,quotient,ratsimp,remainder] [divide,factor,quotient,remainder] [eval,false,if,labels,lambda,quotient,rest,reverse,sum,true] [expand,quotient] [genmatrix,mod,quotient] [makelist,quotient] [quotient,ratsimp,remainder] [quotient,remainder] [quotient]

Related Help

Help for Quotient