Difference between revisions of "RandomPolynomial Command"

From GeoGebra Manual
Jump to: navigation, search
(command syntax: changed [ ] into ( ))
 
(12 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page|version=4.0}}</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}[[Category:Manual (official)|{{PAGENAME}}]]</noinclude>
{{command|CAS}}
+
{{command|probability}}
;RandomPolynomial[ <Degree d> , <Minimum for Coefficients min>, <Maximum for Coefficients max> ]
+
;RandomPolynomial( <Degree> , <Minimum for Coefficients>, <Maximum for Coefficients> )
:Returns a randomly generated polynomial in ''x'' of degree ''d'', whose (integer) coefficients are in the range from ''min'' to ''max'', both included.  
+
:Returns a randomly generated polynomial in ''x'' of degree ''d'', whose (integer) coefficients are in the range from ''minimum'' to ''maximum'', both included.  
{{example| 1=<div>
+
:{{Examples|1=<div>
* <code><nowiki>RandomPolynomial[0, 1, 2]</nowiki></code> yields either ''1'' or ''2'' and
+
:*<code><nowiki>RandomPolynomial(0, 1, 2)</nowiki></code> yields either ''1'' or ''2''.
* <code><nowiki>RandomPolynomial[2, 1, 2]</nowiki></code> yields a random polynomial with a degree of two and only ''1'' and ''2'' as coefficients, for example ''2x<sup>2</sup> + x + 1''.
+
:*<code><nowiki>RandomPolynomial(2, 1, 2)</nowiki></code> yields a random polynomial with a degree of two and only ''1'' and ''2'' as coefficients, for example ''2x<sup>2</sup> + x + 1''.</div>}}
</div>}}
+
 
;RandomPolynomial[ <Variable Var>, <Degree d> , <Minimum for Coefficients min>, <Maximum for Coefficients max> ]
+
==CAS Syntax==
:Returns a randomly generated polynomial in ''Var'' of degree ''d'', whose (integer) coefficients are in the range from ''min'' to ''max'', both included.
+
The following command is only available in the [[File:Menu view cas.svg|link=|16px]] [[CAS View]].
:{{note|In both cases if ''min'' or ''max'' are not integers, ''round(min)'' and ''round(max)'' are used instead.}}
+
 
 +
;RandomPolynomial( <Variable>, <Degree> , <Minimum for Coefficients>, <Maximum for Coefficients> )
 +
:Returns a randomly generated polynomial in ''Variable'' of degree ''d'', whose (integer) coefficients are in the range from ''minimum'' to ''maximum'', both included.
 +
:{{Examples|1=<div>
 +
:*<code><nowiki>RandomPolynomial(a, 0, 1, 2)</nowiki></code> yields either ''1'' or ''2''.
 +
:*<code><nowiki>RandomPolynomial(a, 2, 1, 2)</nowiki></code> yields a random polynomial with a degree of two and only ''1'' and ''2'' as coefficients, for example ''2a<sup>2</sup> + a + 1''.</div>}}
 +
{{Note|1=In both cases if ''minimum'' or ''maximum'' are not integers, ''round(minimum)'' and ''round(maximum)'' are used instead.}}

Latest revision as of 10:23, 11 October 2017


RandomPolynomial( <Degree> , <Minimum for Coefficients>, <Maximum for Coefficients> )
Returns a randomly generated polynomial in x of degree d, whose (integer) coefficients are in the range from minimum to maximum, both included.
Examples:
  • RandomPolynomial(0, 1, 2) yields either 1 or 2.
  • RandomPolynomial(2, 1, 2) yields a random polynomial with a degree of two and only 1 and 2 as coefficients, for example 2x2 + x + 1.


CAS Syntax

The following command is only available in the Menu view cas.svg CAS View.

RandomPolynomial( <Variable>, <Degree> , <Minimum for Coefficients>, <Maximum for Coefficients> )
Returns a randomly generated polynomial in Variable of degree d, whose (integer) coefficients are in the range from minimum to maximum, both included.
Examples:
  • RandomPolynomial(a, 0, 1, 2) yields either 1 or 2.
  • RandomPolynomial(a, 2, 1, 2) yields a random polynomial with a degree of two and only 1 and 2 as coefficients, for example 2a2 + a + 1.
Note: In both cases if minimum or maximum are not integers, round(minimum) and round(maximum) are used instead.
© 2024 International GeoGebra Institute