Register

Programming with function solve

Discuss anything related to calculators. For specific help on certain games/programs check the Released Projects subforum.
Junior Member
Posts: 1
Joined: Fri May 18, 2018 5:10 pm
Calculators: Casio Classpad 300, Casio Classpad 300 plus, Casio Classpad 330, Casio Classpad 330 plus, Casio Classpad fx-CP400

Programming with function solve

Postby Ghostfighter » Fri May 18, 2018 5:44 pm

Hello,

i want to write a programm wich uses a solve command and using its Result

Programm
-----------------------------------------------
Name: test1 N: f,f1,f2,f3

ClrText
Local f,f1,f2,f3

solve(0=f)=>fn
Print "f(x)=0"
Print .....
Print fn

solve(0=f1)=>ef1
Print "f'(x)=0"
Print .....
Print ef1

........

-----------------------------------------------
f(x)= x^3+1.5x^2-2.25x => f

f'(x)=3x^2+3x-2.25 => f1

solve(0=3x^2+3x-2.25)
(x=-1.5,x=0.5) => ef1


now i want to use x=-1.5 and x=0.5 in the f(x) function like the following
f(-1.5)= x^3+1.5x^2-2.25x => np1
and
f(0.5)= x^3+1.5x^2-2.25x => np2
in the programm, but i dont know how i can do this.


It should look like this on the screen if it is possible. I dont know how to get the underlined things the other stuff is working
"
f(x)=0
0 = x^3+1.5x^2-2.25x
(fn)

f'(x)=0
0 = 3x^2+3x-2.25
(x=-1.5,x=0.5)

f(-1,5)=np1
f(0.5)=np2

"

Junior Member
Posts: 5
Joined: Sun Aug 13, 2017 5:59 am
Calculators: Casio fx-9860GII SD Power Graphic 2

Re: Programming with function solve

Postby 3.141592 » Mon Jun 04, 2018 4:49 pm

if you want to set app as add_in {*.g1a located on main menu } , you must use c/c++. all input data for equation must turn to string and separate string with functions on string.h to get parameters of equation;
and solve equation.
or
you can write a pro. (C/C++) that at 1st ask the kind of equation;
and get the equation's parameters from user separately.

unfortunately 9860's sdk has not good method in its lib."fxlib.h" for getting variable from keyboard, just GetKey(&key); so use revolution-fxv0.3.2_setup

Junior Member
Posts: 1
Joined: Sat Jun 09, 2018 4:33 am
Calculators: Casio Afx 2.0, Casio Classpad 300 plus, Casio Classpad 330 plus, Casio Classpad fx-CP400

Re: Programming with function solve

Postby DavidSV » Sat Jun 09, 2018 4:50 am

Ghostfighter wrote:Hello,

i want to write a programm wich uses a solve command and using its Result

Programm
-----------------------------------------------
Name: test1 N: f,f1,f2,f3

ClrText
Local f,f1,f2,f3

solve(0=f)=>fn
Print "f(x)=0"
Print .....
Print fn

solve(0=f1)=>ef1
Print "f'(x)=0"
Print .....
Print ef1

........

-----------------------------------------------
f(x)= x^3+1.5x^2-2.25x => f

f'(x)=3x^2+3x-2.25 => f1

solve(0=3x^2+3x-2.25)
(x=-1.5,x=0.5) => ef1


now i want to use x=-1.5 and x=0.5 in the f(x) function like the following
f(-1.5)= x^3+1.5x^2-2.25x => np1
and
f(0.5)= x^3+1.5x^2-2.25x => np2
in the programm, but i dont know how i can do this.


It should look like this on the screen if it is possible. I dont know how to get the underlined things the other stuff is working
"
f(x)=0
0 = x^3+1.5x^2-2.25x
(fn)

f'(x)=0
0 = 3x^2+3x-2.25
(x=-1.5,x=0.5)

f(-1,5)=np1
f(0.5)=np2

"



Let's go see:

solve(0=3x^2+3x-2.25)
(x=-1.5,x=0.5)=> ef1

ef1 is a list ok? so, ef1 store {x=-1.5,x=0.5} not (x=-1.5,x=0.5), being a list you can get the values separately, how?

ef1[1] and ef1[2] :D

ef1[1] retrieve x=-1.5 and
ef1[2] retrieve x=0.5

If do yo need only the numerical value without the "x=" you can use the getRight function.

getRight(ef1[1]) to get -1.5 only.

Junior Member
Posts: 3
Joined: Mon Aug 12, 2019 5:57 pm
Calculators: Casio Classpad fx-CP400

Re: Programming with function solve

Postby Unnamed » Mon Aug 12, 2019 6:14 pm

I have the same issue.... I get No Solution as return

Solve({A+B-q*l=0,q*0.5*l^2-B*2*l=0},{A,B})=>{K,L}

Print K
Print L

But if i just type

Print Solve({A+B-q*l=0,q*0.5*l^2-B*2*l=0},{A,B})

It displays the right results

Return to General

Who is online

Users browsing this forum: No registered users and 57 guests