Difference between revisions of "Mod Command"

From GeoGebra Manual
Jump to: navigation, search
(command syntax: changed [ ] into ( ))
 
(11 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page|version=4.0}}[[Category:Manual (official)|{{PAGENAME}}]]</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|cas=true|algebra}}
{{command|algebra}}
+
;Mod( <Dividend Number>, <Divisor Number> )
; Mod[ <Integer a>, <Integer b> ]
+
:Yields the remainder when dividend number is divided by divisor number.
:Yields the remainder when integer ''a'' is divided by integer ''b''.
+
:{{example|1=<code><nowiki>Mod(9, 4)</nowiki></code> yields ''1''.}}
;Mod[ <Polynomial>, <Polynomial>]
+
;Mod( <Dividend Polynomial>, <Divisor Polynomial> )
:Yields the remainder when the first entered polynomial is divided by the second polynomial.
+
:Yields the remainder when the dividend polynomial is divided by the divisor polynomial.
==CAS Syntax==
+
:{{example|1=<code><nowiki>Mod(x^3 + x^2 + x + 6, x^2 - 3)</nowiki></code> yields ''4 x + 9''.}}
;Mod[ <Integer a>, <Integer b> ]
+
 
:Yields the remainder when integer ''a'' is divided by integer ''b''.
+
{{note|1=<div>
{{example|1=<div><code><nowiki>Mod[9, 4]</nowiki></code> yields ''1''.</div>}}
+
If you want a function to do this, you can define it yourself, e.g. <code>mod(x, y) = y (x / y - floor(x / y))</code>.
;Mod[ <Polynomial>, <Polynomial> ]
+
</div>}}
:Yields the remainder when the first entered polynomial is divided by the second polynomial.
 
{{example|1=<div><code><nowiki>Mod[x^3 + x^2 + x + 6, x^2 - 3]</nowiki></code> yields ''9x + 4''.</div>}}
 

Latest revision as of 12:00, 5 October 2017


Mod( <Dividend Number>, <Divisor Number> )
Yields the remainder when dividend number is divided by divisor number.
Example: Mod(9, 4) yields 1.
Mod( <Dividend Polynomial>, <Divisor Polynomial> )
Yields the remainder when the dividend polynomial is divided by the divisor polynomial.
Example: Mod(x^3 + x^2 + x + 6, x^2 - 3) yields 4 x + 9.


Note:

If you want a function to do this, you can define it yourself, e.g. mod(x, y) = y (x / y - floor(x / y)).

© 2024 International GeoGebra Institute