GeoGebra-5.04/C3/Scripting-and-LaTeX-in-GeoGebra/English
Keywords: GeoGebra, scripting, latex, input bar, Texworks, if commands, circle, parabola, spoken tutorial, video tutorial.
Visual Cue | Narration |
Slide Number 1
Title Slide |
Welcome to this Spoken Tutorial on Scripting and LaTeX in GeoGebra. |
Slide Number 2
Learning Objectives |
In this tutorial we will learn to,
|
Slide Number 3
System Requirement |
To record this tutorial, I am using;
Ubuntu Linux OS version 18.04 GeoGebra version 5.0660.0-d TeXworks version 0.6.3 The commands shown in this tutorial will work in all 5.0x versions of GeoGebra. |
Slide Number 4
Pre-requisites |
To practise this tutorial,
You should have full version of TeXworks installed on your system. You should be familiar with GeoGebra and LaTeX. For the prerequisite GeoGebra and LaTeX tutorials please visit this website. |
Slide Number 5
Code Files |
The files used in this tutorial are provided in the Code files link.
Please download and extract the files. Make a copy and use them for practising. |
Cursor on the GeoGebra window. | I have opened a new GeoGebra window. |
Only Narration.
|
Let us begin with scripting in GeoGebra.
|
For beginners the Input bar is at the bottom.
Shown as Input: |
In this tutorial we will use the Input bar to draw various objects. |
Type in Input bar:
A= (2,4) >> Press Enter.
|
In the Input bar type A= (2, 4) and press Enter.
|
Cursor near point A. | Now we will use script commands to change the coordinates of point A. |
Type in the input bar:
|
In the input bar type the following command.
This code moves the x coordinate of A by one up and y coordinate by one down.
|
Point to A(3,3) | The coordinates of point A now are (3,3). |
In the Input bar click the up, down arrow keys >>
select the command from the list.
|
Let us execute the same command once again.
|
Type in the input bar >>
Circle(A, 3) >> Press Enter.
|
Now let us draw a circle using point A.
|
Point to the circle c. | Let’s now change the colour of circle c dynamically. |
Type in input bar:
SetDynamicColor[c, Red, Green, Blue] >> Press Enter.
|
Type this command in the input bar and press Enter.
|
Click the Create Sliders button.
Point to the sliders. |
Click the Create Sliders button.
|
Drag sliders Red, Blue and Green back and forth. | Now drag the sliders to see the circle in various combinations of colours.
|
Point to c. | Now let’s create a random circle using a random point B. |
Create a random point B, type in the input bar:
Point to Point B. |
In the Input bar type the following command and press Enter.
Point B is drawn. |
Type in input bar:
|
Now let’s create radius r of circle c randomly using this command.
|
Type in input bar:
|
To get a random circle c, type this command.
|
Press Ctrl + R to move the circle randomly in the Graphics view.
|
Press Ctrl and R keys to move the circle randomly in the Graphics view.
|
Press Ctrl and A keys to select and
Press Delete Key to delete. |
Let us select all the objects and delete them.
|
Only Narration. | Next let's create a randomly generated parabola.
|
Type in the input bar:
A = (RandomBetween[-3,3],RandomBetween[-3,3]) Press Enter. |
To create a random parabola let’s create a random point A.
|
Point to point A. | Point A will be the vertex of the parabola.
|
Press Ctrl and R keys repeatedly. | Press Ctrl and R keys repeatedly.
Observe that the coordinates of point A keep changing.
|
In the Input bar type:
f(x) = ( x + x(A) )^2 + y(A) and press Enter.
|
In the Input bar type the following command.
|
Point to the parabola. | Observe that, parabola opens upwards.
|
Point to the parabola. | To make the parabola open downwards, we need to randomly generate +1 and -1.
|
In the input bar type:
n = RandomBetween[ 0 , 1 ] >> press Enter Point to n value in the Algebra view.
a = If[ n == 1 , 1 , -1 ] >> Press Enter.
|
Type the following command and press Enter.
Here a changes when n is equal to 1.
|
press Ctrl + R keys repeatedly. | Keep pressing Ctrl and R keys repeatedly.
|
Double-click the function f(x) in the Algebra View.
|
Double-click on the function f(x) in the Algebra View.
|
Press Ctrl and R keys repeatedly. | Press Ctrl and R keys repeatedly to see the changes in the parabola. |
Only Narration. | Now we will see how to use IF commands to generate various functions. |
Click on File >> New Window. | For this we will open a new GeoGebra window.
|
Type IF in the input bar to show the list of IF commands. | In general, the IF command is IF[Condition, Then, Else] |
Select the Slider tool(tool is shown as a=2).
Click in the Graphics View. In the Slider dialog box Change name to n. Change the Min value to 0 and Max value to 5. Click the OK button.
|
Let’s first create a number slider n with Min value 0 and Max value 5. |
Select the Move tool(tool shown as arrow). | Click the Move tool to avoid accidental clicking of unnecessary objects.
|
Cursor on the Graphics view. | Let us draw circles of two different radii using the IF command.
|
Type in the input bar:
Press Enter.
|
Type the following command and press Enter.
|
Drag the slider from n=0 to n=3.
|
Now drag the slider from n is equal to zero to n is equal to three.
|
Drag the slider n=0 to n=5.
Point to the circle with different radius. |
As we drag the slider from n=0 to n=5 the radius changes from 1 cm to 4 centimetres.
|
In the Algebra View
Click to select c >> Press Delete key on the keyboard. or Click to select c >> and Right-click on it >> select Delete option. |
Now let’s delete circle c. |
Only Narration. | Next let us draw a segment and a circle in the same manner using the IF command.
|
Drag the slider to n=0. | Let us drag the slider back to n=0. |
Type in the input bar:
Press Enter.
|
Type the following command and press Enter.
|
Drag the slider from n=0 to n>2.
|
Now drag the slider from n=0 to n greater than 2 (n>2).
|
Drag the slider n=0 to n=5.
Point to the segment and circle. |
As we drag the slider from n=0 to n=5 the segment changes to a circle. |
In the Algebra View
Click to select c >> Press the Delete key on the keyboard. |
Again let’s delete the circle c and retain the slider n. |
Drag the slider to n=0. | Let us drag the slider back to n=0. |
Only Narration. | Now we will use the IF command to show trigonometric functions. |
Type in the input bar:
|
Type the following command and press Enter.
|
Drag the slider n=0 to n=5.
|
As we drag the slider from n=0 to n=5,
function change point at algebra views from cos(x) to sin(90-x). |
In the Algebra View
Click to select function >> Press Delete key on the keyboard. |
Let’s delete the function. |
Type in the input bar:
IF[n>2, sin(90-x),tan(x)] |
Similarly let us plot tan(x) and sin(90-x) functions. |
Drag the slider n=0 to n=5.
|
As we drag the slider from n=0 to n=5,
function changes from tan(x) to sin(90-x).
|
Slide Number 6
Assignment |
Pause the tutorial and do this assignment.
|
Only Narration. | Now we will learn how to generate LaTeX code for a GeoGebra file. |
Point to the Code files on the Desktop. | For this let us open the files provided in the Code files link.
I have downloaded and saved them on my Desktop. Please download and save them to your convenient folder. |
Point to the two GeoGebra files. | The Code Files folder contains two GeoGebra files to generate the LaTeX code.
|
Point to Triangle.ggb file.
|
Let us first open the Triangle.ggb file in GeoGebra.
|
Click on File menu and select Export.
|
Click the File menu and select Export.
|
Point to the window. | GeoGebra to PGF Export window opens. |
Click the Format drop-down button.
|
In the window, Format option has a drop-down arrow button.
By default LaTeX(article class) is selected.
|
Click the Generate PGF/TikZ code button in the window. | Now click the Generate PGF/TikZ code button in the window.
|
Point to the generated code. | Code is generated in the text box below. |
Press Ctrl +A to select text.
Press Ctrl + C to copy text.
|
Select the text and copy it.
|
Open your Texworks tex file. | I have opened a new Texworks file.
|
Press Ctrl + V keys to paste in the untitled TeXworks window. | Now paste the copied code in the TeXworks window. |
Click on File and select Save.
Select Desktop to save the file. Type the name as Triangle >> Click on Save. |
To save the file click on File and select Save.
Save dialog box opens. I will save the file on my Desktop. Type the file name as Triangle and click on Save. |
Point to the file name. | File is saved as Triangle.tex.
|
Click the green Typeset button. | Now Click the green Typeset button to run the code.
|
Point to the generated pdf file. | The pdf file of the drawn figure is generated.
|
Show the Code files folder.
|
Let us go back to the Code files folder.
|
Click the File menu and select Export.
|
Click the File menu and select Export.
|
Point to the window. | GeoGebra to PGF Export window opens. |
Click on Format drop down >> Select LaTeX(beamer class) option. | In the Format drop-down let us select LaTeX(beamer class) option.
|
Click the Generate PGF/TikZ code button. | Click the Generate PGF/TikZ code button.
|
Point to the generated code. | The generated code is seen in the text box below.
|
Press Ctrl + A to select text.
Press Ctrl + C to copy text. |
Select the text and copy it. |
Point to the new Texworks file. | I have opened a new Texworks file.
|
Press Ctrl + V keys to paste the code. | Now paste the copied code in the window.
|
Click on File and select Save.
Select Desktop to save the file. Type file name as Arc-sector >> Click on Save. |
To save the file click on File and select Save.
In the Save dialog box, type the file name as Arc-sector and click on Save. |
Point to the saved file. | The file is saved as Arc-sector.tex. |
Click the green Typeset button to run the code. | Now let’s run the file.
Click the green Typeset button to run the code.
|
Point to the generated pdf file. | A pdf file is generated with a number of pages.
|
Scroll through the pages to see the construction in a step by step process. | Pdf file shows the step by step construction of the drawn figure on each page.
|
Only Narration. | With this we come to the end of this tutorial.
Let us summarise. |
Slide Number 7
Summary. |
In this tutorial we have learnt to,
|
Slide Number 8
Assignment |
Here is an assignment for you.
|
Glimpse of assignment | Your completed assignment should look as follows.
|
Slide Number 9
Assignment |
Here is another assignment for you.
|
Glimpse of assignment | Your completed assignment should look as follows.
|
Slide Number 10
About Spoken Tutorial Project |
|
Slide Number 11
Spoken tutorial workshops |
|
Slide Number 12
Forums |
Please post your timed queries in this forum.
|
Slide Number 13
Acknowledgment
|
The Spoken Tutorial project is funded by the Ministry of Education Govt. of India. |
This is Madhuri Ganapathi from, IIT Bombay signing off.
Thank you for watching. |