CAS View

From GeoGebra Manual
Revision as of 07:59, 7 November 2014 by Jhohen (talk | contribs)
Jump to: navigation, search

The CAS view allows you to use GeoGebra's CAS (Computer Algebra System) for symbolic computations. The view consists of cells, each of them has an input field at the top and output display at the bottom. You can use these input fields in the same way as the normal Input Bar, with following differences:

  • you can use variables that were not assigned any value, e.g. (a+b)^2 evaluates to a^2+2*a*b+b^2
  • = is used for equations and := for assignments. This means that a=2 will not assign value 2 to a. See the section about assignments for details.
  • multiplication should be marked explicitly. While in the Input Bar you can use both a(b+c) and a*(b+c) for multiplication, in CAS only the latter is valid.

Basic input

  • Enter: evaluate input
  • Ctrl + Enter: evaluate numerically the input, e.g. sqrt(2) yields 1.41.
  • Alt + Enter: check input but do no evaluate input, e.g. b + b stays as b + b. Note that assignments are always evaluated, e.g. a := 5
  • In an empty row type:
    • Space bar for previous output
    • ) for previous output in parentheses
    • = for previous input
  • Suppress output with a semicolon at the end of your input, e.g. a := 5;

Showing and hiding objects

In the CAS View, the icon to the left of every row shows the current visibility state (shown or hidden) of the object defined in it (when possible). You may directly click on the little white/marble icon in order to change the visibility status of the object in the Graphics View.

Toolbar

  • Clicking a button in the toolbar applies the related command to the currently edited row
  • You can select part of the input text to only apply the operation to this selected part

Using the row header context menu

A right click on a row header shows a context menu, with the following options:

  • Insert Above: inserts an empty row above the current one
  • Insert Below: inserts an empty row below the current one
  • Delete Row: deletes the contents of the current row
  • Text: toggles between the current result and a text showing the current result contained in the row - allows the user to insert comments
  • Copy as LaTeX: copies the contents of the current row to the Clipboard, allowing to paste the contents e.g. in a text object.
Note: To copy the contents of more than one CAS row as LaTeX, select the rows you want with Ctrl+click, then right-click on the row header and select Copy as LaTeX.

Using the cell context menu

A right click on a CAS cell shows a context menu, with the following options:

  • Copy: copies the cell contents to the Clipboard (a right click on a new cell shows a Paste option)
  • Copy as LaTeX: copies the cell contents to the Clipboard, in LaTeX format. (so it can be pasted into a Text object or a LaTeX editor)
  • Copy as LibreOffice formula: copies the cell contents to the Clipboard, in LibreOffice formula format (so it can be pasted in a word processing document)
  • Copy as Image: copies the cell contents to the Clipboard, in PNG format (so it can be pasted into an Image object or in a word processing document)

Variables

Assignments & Connection with GeoGebra

  • Assignments use the := notation, e.g. b := 5, a(n) := 2n + 3
  • To free up a variable name again, use Delete[b]
  • To redefine a variable or function , you must do so in the same cell, otherwise it will be treated as a new variable and renamed
  • Variables and functions are always shared between the CAS view and GeoGebra if possible. If you define b:=5 in the CAS view, then you can use b in all of GeoGebra. If you have a function f(x)=x^2 in GeoGebra, you can also use this function in the CAS view.
Note:
The output will always be just the expression after the :=, e.g. if you type b:=5 the output will be 5. Please also note, that for clarification actually b := 5 will be displayed.

Row References

You can refer to other rows in the CAS view in two ways:

  • Static row references copy the output and won't be updated if the referenced row is subsequently changed
    • # copy the previous output
    • #5 copy the output of row 5
  • Dynamic row references insert a reference to another row instead of the actual output and therefore will be updated if the referenced row is subsequently changed
    • $ insert a reference to the previous output
    • $5 insert a reference to the output of row 5

Equations

  • Equations are written using the simple Equals sign, e.g. 3x + 5 = 7
  • You can perform arithmetic operations on equations, e.g. (3x + 5 = 7) - 5 subtracts 5 from both sides of the equation. This is useful for manual equation solving.
  • LeftSide[3x + 5 = 7] returns 3 x + 5 and RightSide[3x + 5 = 7] returns 7

CAS & Geometry

From 4.9.170.0, the CAS View supports exact versions of some of the geometry commands

test

Exact calculations

Command Tool Evaluate.gif Evaluate Tool Numeric.gif Numeric
or Input,
Rounding 2 Decimal Places
Angle[(1,0),(0,0),(1,2)] arctan \left( 2 \right) Numeric : 1.11
Input : 63.43° or 1.11 rad according Angle Unit selected
AngleBisector[(0,1),(0,0),(1,0)] y = x Numeric : y = x
Input : - 0.71 x +0.71 y = 0
Circumference[x^2+y^2=1/sqrt(π)] 2 \; \sqrt{\pi \; \sqrt{\pi}} 4.72
Distance[(0,0), x + y = 1]

Simplify[Distance[(0,0), x+y=1]]
\frac{1}{\sqrt{2}}

\frac{\sqrt{2}}{2}
0.71
Distance[(0,0),x+2y=4]

Simplify[Distance[(0,0),x+2y=4]]
\frac{4}{\sqrt{5}}

4 \cdot \frac{\sqrt{5}}{5}
1.79
Distance[(0,4),y=x^2]

Simplify[Distance[(0,4),y=x^2]]
\sqrt{ \left( \frac{7}{2} - 4 \right)^{2} + \left( -\frac{1}{2} \; \sqrt{14} \right)^{2}}

\frac{\sqrt{15}}{2}
1.94

Distance[(0.5,0.5),x^2+y^2=1]

Simplify[ Distance[(0.5,0.5),x^2+y^2=1]]
\frac{\frac{1}{\sqrt{2}}}{\sqrt{2}} \; \sqrt{ \left( -\sqrt{2} + 1 \right) \; \left( -\sqrt{2} + 1 \right) \; \sqrt{2} \; \sqrt{2}}

\frac{-\sqrt{2} + 2}{2}
0.29
Ellipse[(2,1),(5,2),(5,1)] 28 \; x^{2} - 24 \; x \; y - 160 \; x + 60 \; y^{2} - 96 \; y + 256 = 0 Numeric : 28 \; x^{2} - 24 \; x \; y - 160 \; x + 60 \; y^{2} - 96 \; y + 256 = 0
Input : 7 \; x^{2} - 6 \; x \; y + 15 \; y^{2} - 40 \; x + - 24 \; y = - 64
Ellipse[(2,1),(5,2),(6,1)] 32 \; x^{2} \; \sqrt{2} + 36 \; x^{2} - 224 \; x \; \sqrt{2} - 24 \; x \; y - 216 \; x \; ...
\; ... + 32 \; \sqrt{2} \; y^{2} - 96 \; \sqrt{2} \; y + 256 \; \sqrt{2} + 68 \; y^{2} - 120 \; y + 196 = 0
Numeric : 81.25 \; x^{2} - 24 \; x \; y - 532.78 \; x + 113.25 \; y^{2} - 255.76 \; y + 558.04 = 0
Input : 81.25 \; x^{2} - 24 \; x \; y - 532.78 \; x + 113.25 \; y^{2} - 255.76 \; y = - 558.04
Radius[x^2+y^2=1/sqrt(π)] \frac{\sqrt{\pi \; \sqrt{\pi}}}{\pi} 0.75

Symbolic computations

Command Tool Evaluate.gif Evaluate Tool Numeric.gif Numeric
Circle[(a,b),r] (y - b)² + (x - a)² = r² Delete.png
Distance[(a,b),(c,d)] \sqrt{ \left( b - d \right)^{2} + \left( a - c \right)^{2}} \sqrt{a^{2} - 2 \; a \; c + b^{2} - 2 \; b \; d + c^{2} + d^{2}}
Distance[(a,b),p x + q y = r]
Line[(a,b),(c,d)] y = \frac{x}{a - c} \; \left( b - d \right) + \frac{1}{a - c} \; \left( a \; d - b \; c \right) y = \frac{a \; d - b \; c + b \; x - d \; x}{a - c}
Line[(a,b),y=p x+q] y = p x - a p + b y = -a p + b + p x
MidPoint[(a,b),(c,d)] \left( \frac{a + c}{2}, \frac{b + d}{2} \right) \left( 0.5 \; a + 0.5 \; c, 0.5 \; b + 0.5 \; d \right)
PerpendicularBisector[(a,b),(c,d)] y = \frac{-a + c}{b - d} \; x + \frac{a^{2} + b^{2} - c^{2} - d^{2}}{2 \; b - 2 \; d} y = \frac{a^{2} - 2 \; a \; x + b^{2} - c^{2} + 2 \; c \; x - d^{2}}{2 \; b - 2 \; d}




Commands and Tools

For a complete list of commands and tools see CAS Commands and CAS tools.

© 2024 International GeoGebra Institute