Register

Using Solve( in basic

Discuss issues related to the Casio Basic Language
Member
Posts: 43
Joined: Thu May 31, 2012 5:45 pm
Location: Greece
Calculators: Casio fx-9860G SD

Using Solve( in basic

Postby hayzel » Mon Jun 11, 2012 8:52 am

Is there a way to use the builtin Solve( in my casio basic program ?
I want to solve a simple polynomial equation of the form:
A X^3+ B X^2 + C X + D =0

A simple code example would be great:
1->A
-2->B
-3->C
5->D
Solve( ?????

Senior Member
User avatar
Posts: 66
Joined: Sun Apr 15, 2012 4:00 pm
Calculators: Casio fx-9860G

Postby aapman55 » Mon Jun 11, 2012 6:01 pm

if you have the equation 3X^2+2X-3=5 and you would like to determine the x values.
then you can write
Code: Select all
Solve(3X^2+2X-3=5,0)


with 0 the initial value. As this equations has 2 solutions be carefull how you choose the initial value. f.i. if you choose the initial value to be -20, the answer will be -2 and if you choose it to be 0 it gives you 1.33333.

If you have used matlab, it is comparable to what you do with fzero, where you also need to "guess" the right initial.

Member
User avatar
Posts: 31
Joined: Wed Apr 18, 2012 4:48 pm

Postby Cartix » Mon Jun 11, 2012 7:15 pm

hayzel wrote:Is there a way to use the builtin Solve( in my casio basic program ?
I want to solve a simple polynomial equation of the form:
A X^3+ B X^2 + C X + D =0

A simple code example would be great:
1->A
-2->B
-3->C
5->D
Solve( ?????


Code: Select all
1->A
-2->B
-3->C
5->D
Solve(AX^3+BX^2+CX+D,X,0)

Member
Posts: 43
Joined: Thu May 31, 2012 5:45 pm
Location: Greece
Calculators: Casio fx-9860G SD

Postby hayzel » Tue Jun 12, 2012 8:07 am

Doesn't help. I was hoping something like the polynomial solver inside EQUA, that gives all the solutions.
I wanted all the three solutions.
I found a trig formula to solve the cubic function for only real solutions. So I used that.

Thanks.

Member
User avatar
Posts: 31
Joined: Wed Apr 18, 2012 4:48 pm

Postby Cartix » Thu Jun 14, 2012 4:04 pm

if you want a code to know all the solution, just say it :D Here it is :
Code: Select all
ClrText
"Entrez l'equation"?->[b]Y[/b]1
1ÞDim List 1
ClrText
Locate 1,1,"Resolution en cours.."
Locate 3,3,"[-              ]"
1->D
0->Q
Locate 5,3,"-"
Abs Int Solve([b]Y[/b]1,-10^6)->A
Locate 6,3,"--"
Int A/10->S
Locate 7,3,"-"
For -A->C To A Step S
Solve([b]Y[/b]1,C)->R
Locate 8+Int (10(C+A)/2A),3,"-"
If R-Qâ10^-9 Or Not Q
Then R->Q
R->List 1[D]
Isz D
IfEnd
Next

The solution are in List 1

Return to Casio Basic Development

Who is online

Users browsing this forum: No registered users and 29 guests