Implicit Functions

1,030 views
Skip to first unread message

JLosse

unread,
Feb 13, 2009, 11:48:12 AM2/13/09
to tinspire
It appears the nSpire has a certain capability of graphing implicitly
defined functions, though I have not found it documented anywhere.

The trick is to use the zeros function.

Try these:

f1(x)=zeros(x^2+y^2-25,y) ( a circle, no big deal)

f1(x)=zeros(x^2+4y^2-3*x*y-7,y) (a rotated ellipse, which is a
bigger deal)

f1(x) = zeros(x^3+4y^2-3*x*y-7,y)

f1(x) = zeros (e^y+y + x,y) bigger deal, since not solvable
for y

Some plot very slowly - try f1(x) = zeros( cos(y) +y - x,y)

Still, this may be useful in some situations. Caveat - do not expect
to be able to perform other operations on these "functions" - without
checking first. It does appear they are "traceable".

John Losse

Nelson Sousa

unread,
Feb 13, 2009, 12:03:53 PM2/13/09
to tins...@googlegroups.com

Very nice trick!!!!

When TI-Nspire plots a function it replaces x by successive numbers and then evaluates whatever was defined. So, for every value of x, you have zeros(polinomial(y),y), which will return a list, that can be plotted (as a family of functions).

However: Only TI-Nspire CAS has the zeros function.

I tried replacing the zeros() function by something using nsolve on non-CAS, but with no success (yet!).


There is a somewhat similar trick that has been used for quite some time to plot derivatives on a TI-84+ (and can also be used on TI-Nspire): Y1=nDeriv(function,x,x) will plot the derivative of function, but I never thought of using it with other functions, such as zeros


Nelson

JLosse

unread,
Feb 13, 2009, 12:21:14 PM2/13/09
to tinspire
Nelson,

This trick (I called it the "zeros method" in a little note in the
Mathematics Teacher in Sept. 2001) actually worked on the TI 89/92+/
Voyage 200, and in some ways was better than TI's documented method
for implicit plots (looking at the z=0 contour of z=f(x,y)), since you
could draw tangents and do some other things.

It is definitely faster (at least on the nspire software) for some
functions, than it was on those handhelds. It will be interesting to
see how far it can be pushed.

John Losse

Sean Bird

unread,
Feb 13, 2009, 12:46:43 PM2/13/09
to tins...@googlegroups.com
John,
Most commendable method.

On page three of the following pdf is an implicit graph of a heart. The program is also given on that page.
http://covenantchristian.org/bird/TTT/NspireCalc/Day15Sec8_9HEARTS.pdf

If anyone is interested in function, polar, parametric, and implicit graphs of hearts, you'll like this pdf.

The implicit program was created by John Hanna and is available on his website http://www.johnhanna.us/TI-nspire.htm


<3,
Sean Bird
Covenant Christian High School
http://covenantchristian.org/bird/Nspire.html
http://bird-godlydominion.blogspot.com/


JLosse

unread,
Feb 13, 2009, 1:31:37 PM2/13/09
to tinspire
Sean,

Thank you - I tried the "zeros method" on your example on p. 3, (i.e.
f1(x) zeros((x^(2)+y^(2)-1)^(3)-x^(2)*y^(3),y)) and it was pretty
speedy.

I had not been aware of John Hanna's approach - will try to figure out
how it works.

John Losse

On Feb 13, 10:46 am, Sean Bird <covenantb...@gmail.com> wrote:
> John,
> Most commendable method.
>
> On page three of the following pdf is an implicit graph of a heart. The
> program is also given on that page.http://covenantchristian.org/bird/TTT/NspireCalc/Day15Sec8_9HEARTS.pdf
>
> If anyone is interested in function, polar, parametric, and implicit graphs
> of hearts, you'll like this pdf.
>
> The implicit program was created by John Hanna and is available on his
> websitehttp://www.johnhanna.us/TI-nspire.htm

Steve A

unread,
Feb 13, 2009, 11:33:35 PM2/13/09
to tinspire
Thank you John - this is HUGE! All these years that I have been using
TI CAS tools and all the time we have been hanging our heads and
apologizing that, No, TI-Nspire can't graph implicit curves... and it
was right there.

This is timely for me - only this week I was working on how to make it
as easy as possible for students to plot conics in their natural form
- Philippe Fortin has done a beautiful job developing his conics
library, and John Hanna's Implicit Plot at least gives non-CAS users
some feel for the shape of the curves (even if very slowly and pretty
rough) but, for CAS users, this is so simple and works for nearly
everything I throw at it (the weak point appears to be anything other
than simple trig functions).

But it gets better - these curves ARE traceable, and will deliver
intersection points and, in most cases, support most geometric actions
like tangent, etc.

For the conics at least you can even use this form to generate
inequalities! Try this:

set f1(x) = zeros(2x - 3y^2 - 4x - 6y - x*y - 4,y)

This generates a list of two expressions in x - the two "halves" of
the parabola.

Now go into f2(x), backspace to erase the "=" and type "> f1(x)[1]"
and press ENTER
Then go to f2(x) again, get rid of the "=" and type "<f1(x)[2]" and
press ENTER.

Shading all points greater than the first zero and less than the
second zero seems in many cases at least to show quite clearly the
implicit inequality as the intersection of the two shadings.

This opens the door to a lot of great things - even the ability now
for students to do linear functions in the general form: zeros(2x - 3y
- 4,y).

It would be simple to write a little function called, say, implicit or
just plot and have it accept just the expression or equation and
complete the syntax (,y) and even support the entry of the form plot
(x^2+y^2=16) as well as plot(x^2+y^2-16).

In fact, it is now part of the add2CAS.tns library available in the
Files section.
> > Covenant Christian High Schoolhttp://covenantchristian.org/bird/Nspire.htmlhttp://bird-godlydominio...

Sean Bird

unread,
Feb 14, 2009, 9:47:56 AM2/14/09
to tins...@googlegroups.com
Oh yea!
I did show my calc students and a few other students with TI-Nspire CAS the 'zeros method' for graphing implicit relations. I love how it graphs and shows f1_1 and f1_2. I had wondered if I would ever use that ability. e.g. graph f2(x)=a*x+0.5|a={0.5,1,2,3}

I like Steve's idea of making it even more user friendly. For some reason some of my students wanted to put ,x,y instead of just ,y. So that will not only freeze up a handheld, but I just tried it on the software and it definitely froze up as well.
So Steve, you can enter an implicit equation like plot(x^+y^2=16) using your latest add2CAS.tns that should be put into the library folder. I'm guessing that plot( ) somehow sets the equation equal to zero, then uses the zeros method and defines it for f1(x). I know I'll find out if I try it, but does it put it in f1(x) each time?

This is quite a boon for helping students visualize the calculus and get an idea of what many graphs look like. I love how you can put a tangent line on it, measure the slope and dynamically explore.

Thanks again John,
Sean Bird
http://bird-godlydominion.blogspot.com/

P.S. I posted a picture and a link to this conversation on my blog.



On Fri, Feb 13, 2009 at 11:33 PM, Steve A <steve.co...@gmail.com> wrote:

Thank you John - this is HUGE! 
 
for CAS users, this is so simple and works for nearly

everything I throw at it (the weak point appears to be anything other
than simple trig functions).

But it gets better - these curves ARE traceable, and will deliver
intersection points and, in most cases, support most geometric actions
like tangent, etc.
plot(x^2+y^2=16) as well as plot(x^2+y^2-16).

JLosse

unread,
Feb 14, 2009, 8:44:17 AM2/14/09
to tinspire
Steve,

Thanks for exploring this, and I am glad it will be useful to you. You
have already found ways to make the method easier to use. Somewhere
we need to compile what we find about the scope of this method and
what the limitations are.

John

John Hanna

unread,
Feb 15, 2009, 7:38:21 AM2/15/09
to tinspire
Sems pretty good, but the following function seems to fail:

-x^(3)+2*x*y+y^(5)-y^(3)=0

It is supposed to have a 'loop' that goes around in the second
quadrant but the loop does not appear. Also, some functions seem to
appear as piecewise graphs.

I've been working on an Implicit graphing document with Steve Arnold
that uses a stat plot to plot the points of the implicit function
which does not rely on CAS. More when it is ready.

- John

JLosse

unread,
Feb 15, 2009, 9:16:31 AM2/15/09
to tinspire
I'm pretty sure there will be shortcomings. Hopefully there will be a
fairly decent class of functions where the zeros method works
reliably.

J Losse

Nelson Sousa

unread,
Feb 15, 2009, 1:41:29 PM2/15/09
to tins...@googlegroups.com

I've also tried to adapt the method to use on non-CAS TI-Nspire, using Nsolve and defining several functions, with different initial guesses (as Nsolve only determines one solution). 

However, the method seems hard to implement in general, and each case must be studied individually.

For example, defining:
f(x)=nSolve(x^2+4*y^2-3*x*y-7=0,y=−3)
g(x)=nSolve(x^2+4*y^2-3*x*y-7=0,y=3)
and
f1(x)= f(x)
f2(x)=g(x)
will plot the ellipse but if one uses different guesses (like +1 and -1), not all of the ellipse will be plotted.


Nelson

Joe

unread,
Feb 15, 2009, 8:03:12 PM2/15/09
to tinspire
Actually e^y+y+x=0 is an example of an equation that just begs to be
solved (for y) using the Lambert W function. Lambert W it is one of
the misc. math functions, and is useful for solving equations
involving exponentials that could not be solved otherwise. It is not
expressable in terms of elementary functions. Wikipedia has a good
write up on this function but beware of the taylor series it offers
which is convergent for a limited range only.

In any case, here gos. e^y+x+y=0, e^y= - (x+y), e^y *e^-(x+y) = - (x
+y)*e^-(x+y), 1/(e^x)= - (x+y) e^-(x+y), Then applying the LambertW
to both sides: LambertW(1/e^x)= -x -y and finally y= - LambertW(1/
(e^x)) - x This last equation can be plotted directly on a student
version of Maple or by using the less expensive SpaceTime math program
on a PC, because those two programs include the Lambert W function.
Then the result can be compared to result of e^y+y+x plotted on the
nspire using the zeros function approach and the two plots will be the
same. This is a good demonstration that shows the use and purpose one
of the misc. math functions. Both approaches produce the same result
except that y= - LambertW(1/(e^x)) - x can be used to determine y to a
much greater accuracy than can be read off a graph on the nspire.

Perhaps TI will add the Lambert W function to nspire or nspire cas at
some time in the future because there are a lot of equations that
cannot be solved with out it.

Steve Arnold

unread,
Feb 16, 2009, 1:56:15 AM2/16/09
to tins...@googlegroups.com, Steve Arnold
There are shortcomings, of course, but the range of cases where the zeros command works beautifully is quite astonishing - even works in cases where the Calculator cannot produce results. Hmmm...

Even more surprising, perhaps, is that "nSolve" works in the same way - AND it works on both CAS and non-CAS, which is GREAT news for all those with vanilla Nspire.

Funny though - in Calculator (even on CAS) if I enter nSolve(x^2 + y^2 = 16, y=2) it spits back an error - cannot take an equation with two variables. But it happily accepts it in Graphs & Geometry.

The difference between the two methods:

* zeros is a more general function and generally gives a good overview of most things you throw at it (except most TRIG functions, since these include constants in the result which G&G cannot evaluate). If you have CAS and you want to look at a relation in  2 variables, then zeros(f(x,y),y) will work well. In fact, it appears to be very reliable up to degree 3, so for all but degenerate conics, it is ideal.

* nSolve works on both CAS and non-CAS - it is VERY slow on the non-CAS handheld, taking a minute or more to generate a part of a curve. I say a part because, like the nSolve command, you generally don't get all the solutions in one hit - you need to enter a GUESS value. So to graph a circle with centre (2, 4) and radius 3 we might enter

f1(x) = nSolve((x-2)^2 + (y - 4)^2 = 9, y = 5 and
f2(x) = nSolve((x-2)^2 + (y - 4)^2 = 9, y = 3

where the two guesses are y-values on either side of the horizontal centre axis of the circle. Values greater than 4 for one and less than 4 for the other would work fine.

Now for the good news: this guess feature sounds like a bit of a pain, but in fact it lets the user quite specifically target parts of a curve, especially parts of a difficult curve that may be missed by the more general zeros command.

For example, consider John Hanna's favourite:

 -x^(3)+2*x*y+y^(5)-y^(3)=0

If you have a CAS, you could use zeros(−x^(3)+2*x*y+y^(5)-y^(3)=0,y) or on non-CAS, nSolve(−x^(3)+2*x*y+y^(5)-y^(3)=0,y) will give you the same result - the bulk of this curve, but missing a part where it loops back over itself.

With just zeros, there is nothing you can do about that. But with nSolve, you can start adding pieces around the area where you can see the curve is missing.

So on a non-CAS (or CAS) you could define:

f1(x) = nSolve(−x^(3)+2*x*y+y^(5)-y^(3)=0,y)

f2(x) = nSolve(−x^(3)+2*x*y+y^(5)-y^(3)=0,y=2)

f3(x) = nSolve(−x^(3)+2*x*y+y^(5)-y^(3)=0,y = 0.45)

f4(x) = nSolve(−x^(3)+2*x*y+y^(5)-y^(3)=0,y = -0.6)

Remember this is a pretty extreme case - for the vast majority of curves, two sections should give the entire picture, but this does illustrate the real advantage here - you can get increasingly better resolution using this "guess" feature.

For students exploring such curves, this is engaging and pedagogically powerful, as they actively pursue the features of the curve that are relevant to their enquiry, rather than sitting passively and have the entire curve revealed for them.

This has implications for some of the other recent discussions - technology is most powerful as an aid to learning when students are active participants in the process, not passive spectators. The challenge of using powerful tools (like CAS, for instance) is to NOT let the tool do all the work!

Steve



With best wishes,
Steve
_________________
Dr Stephen Arnold
Compass Learning Technologies

T3 Fellow, Teachers Teaching with Technology Australia

Mobile: +61-4-0175-3834
_________________

Nelson Sousa

unread,
Feb 16, 2009, 6:08:43 AM2/16/09
to tins...@googlegroups.com

Just a remark, Steve:

The error on nSolve(x^2 + y^2 = 16, y=2) isn't because there are two equations. The command nSolve(x^2 + y^2 = 16, y=2) means "find a numerical solution of the equation x^2 + y^2 = 16 with respect to y, using y=2 as an initial guess". The equation has two variables, so if x is undefined you get an error, as you can't determine a numerical solution of an equation with undefined variables. On the G&G page that error doesn't occur because it solves with respect to y for every value of x, so at each pixel it's a 1 variable equation.


Nelson

Steve Arnold

unread,
Feb 16, 2009, 3:44:56 PM2/16/09
to tins...@googlegroups.com, Nelson Sousa, Steve Arnold
Of course! Thanks Nelson - makes sense now.

Steve

JLosse

unread,
Feb 16, 2009, 9:47:28 PM2/16/09
to tinspire
Steve, et al,

I have found a way that is perhaps a bit easier to "fill in the gaps"
in an example like John Hanna's,
namely, -x^(3)+2*x*y+y^(5)-y^(3)=0

Since the polynomial is fifth degree in y, there are potentially five
zeros for some values of x (and they all actually occur here for x's
near 0.1), as the "true graph" shows.

What you do is define f1(x) = zeros(-x^(3)+2*x*y+y^(5)-y^(3),y) ,as
before.

Then define f2(x)=f1(x)[2] . Since f1 generates a list, this will
return the second element, if there is one.
define f3(x) = f1(x)[3] and so on up to f5(x).

You almost get the "true graph", only there is an annoying vertical
line near x = 0.12481 that I don't understand.

What led to this was the observation that, on a calculator page, f1
(-0.5) reports all the correct values, they just aren't being plotted
in G&G by f1(x) alone. So there is something about the way G&G deals
with an output which is a list that prevents all values from being
plotted.

This is still not perfect - to get the "true graph" you need some
sense of what you are looking for (here, the possibility of five
zeros). There may be other limitations - I'm sure they'll turn up
soon enough.

John Losse
> If you have a CAS, you could use zeros(-x^(3)+2*x*y+y^(5)-y^(3)=0,y)
> or on non-CAS, nSolve(-x^(3)+2*x*y+y^(5)-y^(3)=0,y) will give you the
> same result - the bulk of this curve, but missing a part where it
> loops back over itself.
>
> With just zeros, there is nothing you can do about that. But with
> nSolve, you can start adding pieces around the area where you can see
> the curve is missing.
>
> So on a non-CAS (or CAS) you could define:
>
> f1(x) = nSolve(-x^(3)+2*x*y+y^(5)-y^(3)=0,y)
>
> f2(x) = nSolve(-x^(3)+2*x*y+y^(5)-y^(3)=0,y=2)
>
> f3(x) = nSolve(-x^(3)+2*x*y+y^(5)-y^(3)=0,y = 0.45)
>
> f4(x) = nSolve(-x^(3)+2*x*y+y^(5)-y^(3)=0,y = -0.6)

Steve Arnold

unread,
Feb 16, 2009, 10:15:48 PM2/16/09
to tins...@googlegroups.com, Steve Arnold
Thanks for this Joe - it sent me back to look up something that I haven't used in years! 

Looks like LambertW would be a very useful addition to the toolkit.

Steve

Steve Arnold

unread,
Feb 16, 2009, 10:26:33 PM2/16/09
to tins...@googlegroups.com, Steve Arnold
That is really interesting John - I knew that you can define individual list elements in this way (I have used it to do inequalities for these curves) but it would not have occurred to me that the zeros function would be missing detail because of the list graphing. Fascinating...

I am rather drawn to the idea of using the zeros feature to get all or most of the graph, and then judiciously apply nSolve with appropriate guess values to complete the picture, but your method allows the process to be better automated, making it easier to write a function that will take care of all of this. Of course, it makes the process very much slower if applied, say to a cubic which does not require it.

I am still pretty sure that zeros will give the complete solution for degrees up to 3 (apart from vertical line degenerate cases). If anyone finds a case in that range that does not behave, please let us know.

If the process is reliable for at least degree 2 and 3, then we can use it with confidence for conics, and that would be great.

Steve

John Hanna

unread,
Feb 17, 2009, 8:30:56 AM2/17/09
to tinspire
re John L.'s comment: You almost get the "true graph", only there is
an annoying vertical
line near x = 0.12481 that I don't understand.

jeh>> this is why, in my implicit programs for the TI-84 and the TI-
Nspire, there are two passes across the screen: one left-to-right and
one bottom-to-top. The second pass fills in the 'vertical' portions of
the graph.

JLosse

unread,
Feb 22, 2009, 1:44:43 PM2/22/09
to tinspire
Yes, the "two passes" technique of John Hanna takes care of the
problem. Clever!

Incidentally, I have posted a little file called ellipse_foci which
allows "morphing" a standard ellipse. The foci are shown and move as
the major axis is changed. The "zeros method" is used on the ellipse,
so it is accessible to students who don't have trig or parametric
equations.

J Losse

Joe

unread,
Feb 22, 2009, 8:30:55 PM2/22/09
to tinspire
Thanks Steve. LambertW is sort of like a screw driver. Not very
complicated but when you need it, you need it. As you said, it would
be a very useful addition to the toolkit.

> _________________- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages