[APP]SOLVE
09-19-2016, 12:15 PM
Post: #1
 compsystems Senior Member Posts: 1,341 Joined: Dec 2013
[APP]SOLVE
hello, testing solvers, something strange happens with fsolve

WITH CSOLVE COMMAND:
csolve((X^2-2*X) = -3,X) [ENTER])returns
{1+√2*i,1-√2*i}

approx(csolve({X+Y=2,X*Y=3},{X,Y})) [ENTER])returns
{[1.+1.41421356237*i,1.-1.41421356237*i],[1.-1.41421356237*i,1.+1.41421356237*i]}

WITH FSOLVE COMMAND:
fsolve({x+y = 2, x*y = 3},{x,y},{0,1-i}) [ENTER])returns
{1.+1.41421356237*i,1.-1.41421356237*i}

NOW WITH DIALOG BOX of FSOLVE ([APP]SOLVE [ENTER])
✓ E1: X+Y=2
✓ E2: X*Y=3
[NUM][v (down)] 1+i[ENTER]) show Error Input Invalid. Why?
09-19-2016, 12:37 PM
Post: #2
 Didier Lachieze Senior Member Posts: 1,541 Joined: Dec 2013
RE: [APP]SOLVE
(09-19-2016 12:15 PM)compsystems Wrote:  NOW WITH DIALOG BOX of FSOLVE ([APP]SOLVE [ENTER])
✓ E1: X+Y=2
✓ E2: X*Y=3
[NUM][v (down)] 1+i[ENTER]) show Error Input Invalid. Why?

As written at the beginning of chapter 14. Solve App in the manual:
Quote:Solve works only with real numbers.
09-19-2016, 01:09 PM
Post: #3
 compsystems Senior Member Posts: 1,341 Joined: Dec 2013
RE: [APP]SOLVE
but why it works only with real numbers?

I think then do not call the function fsolve of CAS, if not a pseudo numerical solver

Operate only with real numbers is a useless application, the true algebra covers the field of to complex numbers y the hpprime is a modern calculator
09-20-2016, 01:31 AM
Post: #4
 BERNARD MICHAUD Member Posts: 149 Joined: Aug 2015
RE: [APP]SOLVE
Try Linear Solver+ App from the Software Library.

Similar to Linear Solver App, but works with Complex Numbers. 2x2 or 3x3.

7+8*i + 4+5*i = 22+4*i
4+5*i + 3+2*i = 18+6*i

X = 1.7-3.9*i
Polar = [4.2544,-66.44]

Y = 0.1+4.3*i
Polar = [4.30116,88.6677]
09-20-2016, 12:08 PM
Post: #5
 compsystems Senior Member Posts: 1,341 Joined: Dec 2013
RE: [APP]SOLVE

LSX.hpprgm
Code:
quit(); MAT2(); MAT3(); MAINMENU(); local OPN; local Z10,Z11,Z12,Z13,Z14,Z15; local Z16,Z17,Z18,Z19,Z20,Z21; //_________________________________________________________ MAINMENU() BEGIN     HFormat:=0;          LOCAL CH:=0;          CHOOSE(CH,"Linear Solver 2x2 and 3x3.",     {"  Quit Linear Solver",     "  Linear Solver 2x2.",     "  Linear Solver 3x3."}); IF 0 THEN IFERR BREAK; BREAK; THEN END END; CASE     IF CH == 1 THEN IFERR BREAK; BREAK; THEN END END; IF CH == 2 THEN MAT2(); END; IF CH == 3 THEN MAT3(); END; IF CH == 4 THEN PRINT();     PRINT("     Linear Solver.          by: Bernard Michaud.     Aug. 20 2016.     Toronto, ON.          ");         IFERR REPEAT UNTIL GETKEY>-1;         THEN MAINMENU();         ELSE         MAINMENU();     END; END; DEFAULT IFERR BREAK; BREAK; THEN END END; END; quit() BEGIN     PRINT();     PRINT(" ");         IFERR REPEAT UNTIL GETKEY>-1;         THEN MAINMENU();     END;     MAINMENU(); END; //---------------------------------------------------- MAT2() begin          INPUT({     {Z10,[3],{5,22,1}},{Z11,[3],{40,22,1}},{Z12,[3],{72,22,1}},     {Z13,[3],{5,22,3}},{Z14,[3],{40,22,3}},{Z15,[3],{72,22,3}}},     "Solver 2x2.",     {"","X  +  ","Y  =",     "","X  +  ","Y  ="});          MAKEMAT(0,2,3)▶M1;     M1(1,1):=Z10;M1(1,2):=Z11;M1(1,3):=Z12;     M1(2,1):=Z13;M1(2,2):=Z14;M1(2,3):=Z15;     RREF(M1)▶M2;     col(M2,(3))▶M3;     PRINT();     PRINT("          X = "+M2(1,3)+"      Polar = "+polar_coordinates(M2(1,3))+"          Y = "+M2(2,3)+"      Polar = "+polar_coordinates(M2(2,3))+"               Press [ENTER] to Continue...");         IFERR REPEAT UNTIL GETKEY>-1;         THEN         CHOOSE(OPN,"",{"BM"});         CASE             IF OPN==1 THEN PRINT(); END;             DEFAULT         END;         ELSE         CHOOSE(OPN,"Choose Option below.",         {         "  Back to Linear Solver 2x2",         "  Back to Main Menu...",         "  Quit"});         CASE             IF OPN==1 THEN MAT2(); END;             IF OPN==2 THEN MAINMENU(); END; IF OPN==3 THEN IFERR BREAK; BREAK; THEN END END; DEFAULT END; END; END; //_________________________________________________________ MAT3() begin          INPUT({     {Z10,[3],{5,16,1}},{Z11,[3],{30,16,1}},{Z12,[3],{55,16,1}},{Z13,[3],{80,16,1}},     {Z14,[3],{5,16,3}},{Z15,[3],{30,16,3}},{Z16,[3],{55,16,3}},{Z17,[3],{80,16,3}},     {Z18,[3],{5,16,5}},{Z19,[3],{30,16,5}},{Z20,[3],{55,16,5}},{Z21,[3],{80,16,5}}},     "Solver 3x3.",     {"","X+","Y+","Z=","","X+","Y+","Z=","","X+","Y+","Z="});          MAKEMAT(0,3,4)▶M1;     M1(1,1):=Z10;M1(1,2):=Z11;M1(1,3):=Z12;M1(1,4):=Z13;     M1(2,1):=Z14;M1(2,2):=Z15;M1(2,3):=Z16;M1(2,4):=Z17;     M1(3,1):=Z18;M1(3,2):=Z19;M1(3,3):=Z20;M1(3,4):=Z21;     RREF(M1)▶M2;     col(M2,(4))▶M3;     PRINT();     PRINT("          X = "+M2(1,4)+"        Polar = "+polar_coordinates(M2(1,4))+"          Y = "+M2(2,4)+"        Polar = "+polar_coordinates(M2(2,4))+"          Z = "+M2(3,4)+"        Polar = "+polar_coordinates(M2(3,4))+"          Press [ENTER] to Continue...");              IFERR REPEAT UNTIL GETKEY>-1;         THEN         CHOOSE(OPN,"",{"BM"});         CASE             IF OPN==1 THEN PRINT(); END;             DEFAULT         END;         ELSE         CHOOSE(OPN,"Choose Option below.",         {         "  Back to Linear Solver 3x3",         "  Back to Main Menu...",         "  Quit"});         CASE             IF OPN==1 THEN MAT3(); END;             IF OPN==2 THEN MAINMENU(); END; IF OPN==3 THEN IFERR BREAK; BREAK; THEN END END; DEFAULT END; END; END; //___________________________________________________________ EXPORT LSX()//4K BEGIN     MAINMENU(); END;
09-20-2016, 08:48 PM
Post: #6
 compsystems Senior Member Posts: 1,341 Joined: Dec 2013
RE: [APP]SOLVE
for hp-prime team:
It not intended to be symbolic coefficients on app solve or linear solve, but at least they can be general case encompassing complex numbers, The hardware hp-prime can with more than app numerical and real problems.
I hope to be included in the next firmware
 « Next Oldest | Next Newest »

User(s) browsing this thread: 1 Guest(s)