2D and 3D plots

37
TIME 2012 Technology and its Integration in Mathematics Education 10 th Conference for CAS in Education & Research July 10-14, Tartu, Estonia Selected Examples by Michel Beaudin Overview Important Features of 2D plots. What about 2D plots in Nspire CAS? 2D and 3D plots (DERIVE, Nspire). Piecewise Continuous Functions. Show Step Simplification. Compact/Simplified Answers. Controlling Precision. Domain Definition. Some Important Features of 2D Plots Given an equation of the form f(x) = g(x), one can select the LHS, the RHS or the whole equation: DERIVE plots what is highlighted when you open a 2D plot window. This feature of DERIVE has many teaching advantages. Example: x 2 = 4. What do you want to plot?

Transcript of 2D and 3D plots

Page 1: 2D and 3D plots

TIME 2012 Technology and its Integration in Mathematics Education

10th Conference for CAS in Education & Research July 10-14, Tartu, Estonia

Selected Examples by Michel Beaudin

Overview

Important Features of 2D plots. What about 2D plots in Nspire CAS? 2D and 3D plots (DERIVE, Nspire). Piecewise Continuous Functions. Show Step Simplification. Compact/Simplified Answers. Controlling Precision. Domain Definition.

Some Important Features of 2D Plots

Given an equation of the form f(x) = g(x), one can select the LHS, the RHS or the whole equation: DERIVE plots what is highlighted when you open a 2D plot window.

This feature of DERIVE has many teaching advantages.

Example: x2 = 4. What do you want to plot?

Page 2: 2D and 3D plots

The highlighted part of the expression is plotted – running from the parabola via the horizontal line y = 4 to the solutions of the equation x2 = 4.

Implicit plots and plots of two columns matrices.

Example: The system

2 2

24 9

3

x y

x y

+ =

⋅ =

A few seconds and you see both curves, the intersection points (and the “Gröbner Basis” function informs you how DERIVE solved this system!!!).

Page 3: 2D and 3D plots

This last example is a nice illustration of “Point. Click. Derive.”

Complicated equation(s) can be easier solved numerically if a starting point is given (with the help of a graph!).

Example: find one complex solution to the equation 16 1.01 2.zz −= + ((The “solve” command fails in DERIVE: the “csolve” command of Npsire CAS finds no complex solutions but finds the 3 real solutions!)

We simply need to define f(z) to be 16( ) : 1.01 2zf z z −= − − and to substitute for z a complex

number x + i⋅y. Then plot the real and imaginary parts of f(x + i⋅y) = 0 in the same window.

The fact that DERIVE has a “Simplify Before Plotting” command is very useful (TI should add this in Nspire CAS).

Now you plot #2 and #3 in the same window (“Simplify Before Plotting” being used: no necessity to simplify #2 or #3):

Page 4: 2D and 3D plots

What About 2D Plots in Nspire CAS?

(In OS 3.2) The 2D plot window graph Entry/Edit accepts up to 7 different types but 2D implicit plots are still missing.

Slider bars, animations, dynamic geometry, styles and colors make each of these 2D plot windows very attractive and useful for teaching mathematics and sciences.

Page 5: 2D and 3D plots

The plotting algorithm of Nspire CAS seems to be different from the one of Voyage 200.

In fact, in V200, if we use the Y= Editor and type y1(x) = zeros(expr, y) where expr is

an expression in variables x and y, it takes a VERY long time but the implicit graph comes out!!!

Example: Let’s consider the 2D implicit curve given by the equation

2 sin( ) 5 0.x y y+ − = There is no way to solve for y, so a real 2D implicit plotter is required for the graph.

Here are the graphs showed by DERIVE, Nspire CAS and V200:

DERIVE

TI-NspireCAS

Voyage 200

2D and 3D Plots: Important Features

A fast and accurate 2D implicit plotter is a must in multiple variable calculus for plotting level curves.

Here is an example where 3D plotting will also be used

Example: We will plot some level curves of the function 2 2

( , ) .x yf x y x y e− −= The autoscaling 3D plot command can be used to find the maximum value. The highest point on the surface can be plotted because DERIVE can plot 3 columns matrices in various ways. Splitting windows allows the teacher to show the relationship between level curves in 2D and level curves on the surface.

Page 6: 2D and 3D plots
Page 7: 2D and 3D plots

What About 3D Plotting in Nspire CAS? Major improvements with David Parker on board: in OS 3.2, parametric 3D plotting has been added.

Here is the graph of the function from the former example performed with Nspire CAS (I don’t know how to plot the maximum point):

Page 8: 2D and 3D plots

Piecewise Continuous Functions

Indicator (“CHI”), signum (“SIGN”), and Heaviside (“STEP”) functions are built-in; in Nspire CAS, only “sign” is built-in.

The symbolic integration of products with other functions works correctly.

The reason: DERIVE knows the rule:

( ) sign( ) sign( ) ( ) subst ( ) , , bf x ax b dx ax b f x dx f x dx xa

+ → + − −

∫ ∫ ∫

This rule is applied when you want to compute integrals some integrals (this is the case when someone needs to find a Fourier series): let’s try ( )sin( )sign x x dx∫ and 2 5 6x x dx+ +∫ .

And let’s compute the Fourier series of a square wave.

Examples:

DERIVE not only knows the rule but can SHOW it to the user with the “Display Step” button. Let’s talk about this now.

Show Step Simplification

For integrals, this is comparable to be looking into a book on Standard Mathematical Tables and Formulae.

Each of the following examples has a particularity that would be lost or unknown without the Show Step Simplification option.

Page 9: 2D and 3D plots

Examples:

Sometimes DERIVE is unable to get a closed form but you learn something!

31 x dx+∫

Sometimes, it is just amazing!

( )

2

0

11 tan r dxx

π

+∫

Page 10: 2D and 3D plots

Sometimes, DERIVE does exactly what a math teacher would do:

( )2

23 1

( 1) 4x dx

x x x+

− +∫

Page 11: 2D and 3D plots
Page 12: 2D and 3D plots

The Importance of Compact/Simplified Answers

Solving cubic polynomial equations: when all 3 solutions are real, DERIVE uses trigonometric substitutions (Maple is using Cardano’s formula and complex numbers appear; Nspire CAS is also using trig answers but not in a very attractive way…):

Example: 3 3 1 0x x− + = DERIVE:

MAPLE: >

TI-NspireCAS:

Solving cubic polynomial equations: when only one solution is real, all systems are using Cardano’s formula. But DERIVE’s answer is the nicest one: NO radicals in the denominator!

Example: 3 3 5 0x x+ + =

Page 13: 2D and 3D plots

DERIVE:

MAPLE:

>

TI-NspireCAS:

Can your favourite CAS simplify these?

Nested radicals: 3 15 3 26⋅ +

Complex numbers written in various forms:

18

234

( 1) 1

2

ii i eπ− +

+

Page 14: 2D and 3D plots

DERIVE

MAPLE

TI-NspireCAS:

Page 15: 2D and 3D plots

Everything should be made as simple as possible, but not simpler.

Albert Einstein

The Importance of Controlling Precision It is important of being able to increase the number of digits of precision: Nspire CAS software is restricted to 14 digits (as the handheld), not DERIVE.

Example: The number e: Let’s compute 6 2011 , 100,1000,10 ,10 ,...n

nn

+ =

and observe what’s going on …

Page 16: 2D and 3D plots

The Importance of Domain Definition

• In Nspire CAS, one can restrict the domain of a variable INSIDE a command or definition.

• An arbitrary variable x is real by default while x_ is complex and n1 (@n1) is an integer. • In DERIVE, the domain of a variable can be set by a command. Moreover, the domain

can also be vector, set and logical. Examples:

Thank You!

Page 17: 2D and 3D plots

Selected Examples by Josef Böhm

There will be some examples which are meeting Michel’s topics. I don’t remove them because they might accomplish our point of view. My focus is more directed to secondary school problems including lower secondary school.

Overview

Simplifying and Manipulating Trig-expressions. Simplifying and Manipulating Subexpressions. “Real” Random Numbers. Recursion and Iteration. Mix Cartesian and Polar Form Implicit Plotting 3D Plotting. FIT-function. Final Missings. My DERIVE Favourite.

Page 18: 2D and 3D plots

Simplifying and Manipulating Trig-expressions

One of our DUG-Members came across this "nice" expression:

and wanted to simplify it! Question: Is it possible to do it? Let’s try with TI-Nspire:

We receive bulky expressions which are not really “simpler”!! And now the next try with DERIVE:

Page 19: 2D and 3D plots

I set Trigonometry Collect and …

It needs only two key strokes. I come back to Nspire and can only verify the DERIVE result:

With DERIVE we can also do it simplifying subexpressions!

Page 20: 2D and 3D plots

Applying Stepwise Simplification (see Michel’s contribution) we could follow the rules which were used to obtain the “simple” result.

Page 21: 2D and 3D plots

"Real" (Pseudo)Random Numbers Simulations often require random numbers or even sequences of random numbers. Take the best known example: Rolling a die:

The problem is that it is necessary to enter a RandSeed number for initializing the random number generator. Taking the easiest number “12345” will always produce the same sequence of random numbers. Same happens without entering a RandSeed. DERIVE’s random number generator can be based on the CPU-time.

The command RANDOM(0) calls internally the CPU-time in order to generate random numbers. RANDOM(0) can be used within programs or as a stand alone command as well.

Page 22: 2D and 3D plots

If necessary – because of didactical reasons – you can also generate identical sequences of random numbers

Page 23: 2D and 3D plots

Recursions and Iterations

Both concepts are demonstrated by the well known Newton-Raphson method:

Recursion is very important algorithmic concept which should be treated in maths education – but it is slow compared with iteration.

The recursion needs 4.64 sec and the iteration needs only 0.015 sec. Iteration with 20 recursion steps needs 150 seconds.

I am quite sure that you know the Fibonacci Numbers, but do you know the TRIBONACCI Numbers, too?

1 2 3

1 2 3

4

1, 2n n n n

a

a a a a for na a

− − − ≥= + += = =

Page 24: 2D and 3D plots

This was the RECURSIVE way.

How to do it as an ITERATION?

We don’t have ITERATE(S) or a similar function in Nspire and for performing the recursion I need working in the List & Spreadsheet Application.

Page 25: 2D and 3D plots

ITERATE and ITERATES can be used for sophisticated constructions.

(Hannes Wiesenbauer was the "Master of ITERATES" in the Derive Newsletters.

POWERMOD(a, n, m) ≔ If n ≥ 0 MOD(a^n, m) If GCD(a, m) = 1 MOD(MOD((ITERATE(IF(MOD(a_, b_) = 0, [a_, b_, c_, d_], [b_, MOD(a_, b_), d_, c_ - FLOOR(a_, b_)·d_]), [a_, b_, c_, d_], [a, m, 1, 0]))↓4, m)^(-n), m)

The POWERMOD-function is implemented in the latest DERIVE versions:

ITERATE and ITERATES can be programmed. Terrence Etchells wrote some tools in the first days of the TI-92 to have some of his favourite commands and functions available on the handheld.

It is not too difficult to implement one’s own ITERATE(S) as you can see below:

Page 26: 2D and 3D plots

On the evening after our common presentation Michel told me that recursion can be done with TI-NspireCAS and he gave some advice how to do.

And it is true. I have to apologize for my complaints about missing recursion. In contrary, using the piecewise function template it is easy to perform recursion.

See the Tribonacci sequence and the Newton-Raphson algorithm defined recursively:

Hermite polynomials follow a recursive procedure:

1 1

0 1

( ) 2 ( ) 2 ( )( ) 1, ( ) 2M M MH x xH x M H x

H x H x x+ −= −

= =

Page 27: 2D and 3D plots

I try my self made ITERATES with TI-NspireCAS:

The Hermite polynomials can be read off in the first column of the matrix. I could change the function to return only the nth polynomial.

I know from my experience as teacher trainer that there are not so many Nspire users who like to program more than short functions. So it would be great to have this function – and others, which we know from DERIVE – available for all users.

Page 28: 2D and 3D plots

Manipulating and Simplifying Subexpressions

This is very important for younger students and their teachers, of course. I am very grateful that Walter Klinger provided some examples from his rich experience in teaching mathematics CAS-supported in Secondary One level.

The students can control and train their manual manipulating skills – if necessary!

Page 29: 2D and 3D plots

Learning in the White Box Phase using substituting and „re“substituting and simplifying subexpressions Example: transform into a product ("Factor")

(3m + 1)2 – (2m – 3)2 Using the Black Box/White Box-Principle pupils must transfer the problem to DERIVE. They first use Factor as a Black Box. DERIVE-Output is: (m + 4)·(5·m - 2) Now the pupils try to transform the Black-Box situation into a white one. First they have to recognize the structure of the term which is a2 – b2 Then the pupils can proceed mentally calculating.

Page 30: 2D and 3D plots

Changing numbers into variables and building terms – by using Subexpression Substitution (1 becomes the new value a etc.)

Page 31: 2D and 3D plots

Mix Cartesian and Polar Forms, Implicit Plotting

It is possible to mix Cartesian, polar and parametric representations in one plot. Implicit plotting is available for conics only.

Page 32: 2D and 3D plots

3D Plots

The latest versions of TI-NspireCAS allow plotting surfaces in Cartesian form z = f(x,y) and in parameter form and space curves given in parameter form. I can not plot segments connecting points or even single points. The next example shows an upright triangle together with its shadow on the xy- and yz-plane.

It is no problem to perform the calculation with TI-NspireCAS but we cannot show the 3D representation (without transforming into a 2D-plot). Calculate and plot!

Page 33: 2D and 3D plots

Regression lines - FIT-function

TI-NspireCAS provides a wide range of regression lines. But unfortunately this tool is not flexible enough. DERIVE’s FIT-function can be used to modify the approximating function.

The LORENZ-curve for calculating the GINI-coefficient is forced to pass the origin! Another example: I'd like to approximate the scatter diagram by an even polynomial of order 4. (W-form)

Page 34: 2D and 3D plots

As I said before: One can often help himself by writing a program. See the program for a generalized regression line based on not too difficult matrix calculations (normal matrix).

You are invited to compare the genreg-results with the results given by applying DERIVE’s FIT-function.

As it cannot be expected of the majority of the Nspire users to program the tools they should be implemented.

Page 35: 2D and 3D plots

Final missings!

Compare the DERIVE results with the Nspire answers!

Page 36: 2D and 3D plots

DERIVE

TI-NspireCAS

2

12π

Page 37: 2D and 3D plots

My DERIVE favourite

I want to plot a grid in the plane and it needs only to mouse clicks!

Many thanks for your attention.

In the following discussion Carl Leinbach showed soem applications of working with long integers (with DERIVE) investigating DNA-sequences and other topics from biomathematics. He told that unfortunately this cannot be done with TI-NspireCAS – even not with the PC-version because of its limited number of digits. Overall it can be said that much has been done since the appearance of TI-NspireCAS on the market in 2006. We had several „transition meetings“ with the Nspire developers and we can see that a lot of highly appreciated DERIVE features have been implemented since then – but there are still a lot of DERIVE capabilities remaining and waiting for being built in. We hope that the day will come – in a not too far future – that we can say: TI-NspireCAS is he true successor of DERIVE. (All files presented in this paper are available from the authors.)