Difference between revisions of "Function Command"
From GeoGebra Manual
Line 2: | Line 2: | ||
{{command|function}} | {{command|function}} | ||
;Function[Function f, Number a, Number b]: Yields a function graph, that is equal to ''f'' on the interval [''a'', ''b''] and not defined outside of [''a'', ''b'']. | ;Function[Function f, Number a, Number b]: Yields a function graph, that is equal to ''f'' on the interval [''a'', ''b''] and not defined outside of [''a'', ''b'']. | ||
− | :{{Note|1= | + | :{{Note|1=This command should be used only to restrict the '''display''' interval of a function. To restrict the function’s domain, create a conditional function using the [[If Command|If command]], e.g. <br/><code>f(x) = If[-1 < x < 1, x²]</code>.}} |
:{{example|1=<code>f(x) = Function[x^2, -1, 1]</code> produces a function equal to ''x<sup>2</sup>'' whose graph appears only in the interval [''-1'', ''1'']. However, while <code>g(x) = 2 f(x)</code> will produce the function ''g(x) = 2 x<sup>2</sup>'' as expected, this function is not restricted to the interval [''-1'', ''1''].}} | :{{example|1=<code>f(x) = Function[x^2, -1, 1]</code> produces a function equal to ''x<sup>2</sup>'' whose graph appears only in the interval [''-1'', ''1'']. However, while <code>g(x) = 2 f(x)</code> will produce the function ''g(x) = 2 x<sup>2</sup>'' as expected, this function is not restricted to the interval [''-1'', ''1''].}} | ||
:{{Note|1=This command does not work with Tools / Macros. Use the [[If Command|If command]] as above.}} | :{{Note|1=This command does not work with Tools / Macros. Use the [[If Command|If command]] as above.}} |
Revision as of 15:18, 9 July 2012
- Function[Function f, Number a, Number b]
- Yields a function graph, that is equal to f on the interval [a, b] and not defined outside of [a, b].
- Note: This command should be used only to restrict the display interval of a function. To restrict the function’s domain, create a conditional function using the If command, e.g.
f(x) = If[-1 < x < 1, x²]
. - Example:
f(x) = Function[x^2, -1, 1]
produces a function equal to x2 whose graph appears only in the interval [-1, 1]. However, whileg(x) = 2 f(x)
will produce the function g(x) = 2 x2 as expected, this function is not restricted to the interval [-1, 1].
- Note: This command does not work with Tools / Macros. Use the If command as above.
Following text is about a feature that is supported only in GeoGebra 4.2.
Example: Function[{2, 4, 0, 1, 0, 1, 0}] yields a triangular wave between x=2 and x=4.
Function[{-3, 3, 0, 1, 2, 3, 4, 5}] yields a linear equation with slope =1 between x=-3 and x=3. |