discriminant of a quadratic

53 views
Skip to first unread message

Sheila

unread,
Nov 8, 2009, 11:26:51 AM11/8/09
to tinspire
Hi
I'm trying to write a program that will find the discriminant and
display the nature of the solutions. I know how to begin but get lost
when trying to write the "when" or if statements...If you have a file
that is great I can look at that but I would also like to know what to
do.
thanks,
Sheila

Andy Kemp

unread,
Nov 8, 2009, 11:37:17 AM11/8/09
to tins...@googlegroups.com
Sheila,

I'm not sure I completely understand what you want to do, are you trying to write a function for the calculator page like:
disc("x^2+3x+2")

Are you doing this on the CAS or non-CAS version?

I wrote something a while ago which calculated the discriminant of a quadratic on the G&G page and allowed you to drag the graph around and observe the effect on the discriminant... 

You can find it attached - it is designed to be viewed on the handheld

Cheers
Andy
Discriminant.tns

Sheila

unread,
Nov 9, 2009, 1:22:07 PM11/9/09
to tinspire
very nice file..I like the diagram and ideas....what I want to do is
write a program(function) that will give the discriminant (I can do
this) but then also state whether there is 1 real, two real, two
complex conjugates based on the result. I know I can do it with when
statements but I'm not sure how to write it into the program.
>  Discriminant.tns
> 8KViewDownload- Hide quoted text -
>
> - Show quoted text -

Steve Arnold

unread,
Nov 9, 2009, 5:11:03 PM11/9/09
to tins...@googlegroups.com
This should fit the bill Sheila:

Define LibPub discr(a,b,c)=
Func
:Local d,eq
:d:=b^(2)-4*a*c
:eq:=string(a)&"x²+"&string(b)&"x+"&string(c)
:Disp "The discriminant of ",eq," is ",d
:If d=0 Then
:Disp "This is a perfect square with two equal solutions"
:ElseIf d>0 Then
:Disp "Two distinct real solutions"
:Else
:Disp "No real solutions"
:EndIf
:Return d
:EndFunc

Hope this helps

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

T3 Fellow, Teachers Teaching with Technology Australia

Office: +61-2-4232-2080
Mobile: +61-4-0175-3834
Web: http://compasstech.com.au
_________________

Reply all
Reply to author
Forward
0 new messages