Solution to the problem of pre-assigned variables to 0
10-25-2018, 06:20 PM (This post was last modified: 11-04-2018 08:20 PM by compsystems.)
Post: #1
 compsystems Senior Member Posts: 1,183 Joined: Dec 2013
Solution to the problem of pre-assigned variables to 0
Solution to the problem of pre-assigned variables A, ... Z, Z0, ..., Z9, F0, F9, ..., V0, ..., V9 etc. to 0

Hello HPPrimeTEAM and users, one of the difficulties of the HPPrime calculator, is that there is no integration between CAS and NUM/HOME mode and especially in applications, since they are using predefined variables, in addition students have problems in differentiating X with x, since X is predefined to zero, they always call me, I do not get what I expected, another student asks me if X is set to zero, because when creating the function does not evaluate it.

There is no consistency in the hpprime system

X [enter] returns 0
F1(X) := 8 * X - 5 This should return -5
solve((right(F1)) = 0,X,'=') returns [] // synonym of no solution.

x:=0 [enter] returns 0
assume(x,symbol) // Remove the value of 0, changing the data type to symbolic
x [enter] returns x
F10(x) := 8 * x - 5

One solution that I propose is that the variables are predefined with 'noValue' instead of zero, in this way

X + 3 [enter] in NUM/Home mode returns "Syntax error" // ok, because it can not evaluate X, X has symbolic value
X + 3 [enter] in CAS mode returns X + 3 // ok because X is considered a symbolic variable

then:
X:=5
X + 3 [enter] in NUM/Home mode returns 8
X + 3 [enter] in CAS mode returns 8

restore(X) [enter] returns 'noValue'
X + 3 [enter] in NUM/Home mode returns "Syntax error" // ok

What do you think of this idea?

Another Case:

V1(X,Y) := (X²/3 - Y²/5 = 1); [enter] returns (X,Y)->(((X^2/3)-(Y^2/5))==1) // error
(X,Y)->((X^2/3)-(Y^2/5))=1 // ok
right(V1) [Enter] returns 0 // (0 synonymous of false), error because although ((X^2/3)-(Y^2/5) == 1 is false, this should not be compared, it must be interpreted as equation (X,Y) -> ((X^2/3)-(Y^2/5))=1

I do not use x in lowercase because the internal user variable V1 requires it [SYMB KEY], I also want to perform analytical [CAS], graphical [PLOT KEY] and numeric analyzes [NUM KEY] using the same definition.

Thanks

LO SUFICIENTEMENTE BUENO ES ENEMIGO DE LA EXCELENCIA.
11-11-2018, 01:57 PM
Post: #2
 compsystems Senior Member Posts: 1,183 Joined: Dec 2013
RE: Solution to the problem of pre-assigned variables to 0
Hello, in the first code using quotation marks the expression is not evaluated, that is to say it is kept symbolic.

PHP Code:
#casprg01(  ):=    begin        PRINT;         print(   'X²/3 - Y²/5 = 1'  );  // ' Do not evaluate        print(   X²/3 - Y²/5 = 1  );  //  X -> 0        return 'X²/3 - Y²/5 = 1' ;    end;#end
prg01( ) [enter]
show
X²/3 - Y²/5 = 1
0=1

in the second code, assume X as symbolic, there is no need to use ' '
this same procedure should work assuming X as noValue

PHP Code:
#cas    prg02(  ):=    begin        local X, Y;         assume(X, symbol); //  assume X as symbolic        assume(Y, symbol);         print( X²/3 - Y²/5 = 1 );        return  X²/3 - Y²/5 = 1;    end;#end
prg02( ) [enter]
show
X²/3 - Y²/5 = 1

LO SUFICIENTEMENTE BUENO ES ENEMIGO DE LA EXCELENCIA.
11-11-2018, 06:20 PM
Post: #3
 Han Senior Member Posts: 1,811 Joined: Dec 2013
RE: Solution to the problem of pre-assigned variables to 0
Those variables behave exactly the way they do by design. Rather than trying to change the design (which I highly doubt will ever happen as the HP Prime is several years now in the market), you would be better off using non-system variables for what you want to do.

Graph 3D | QPI | SolveSys
11-12-2018, 09:07 PM
Post: #4
 compsystems Senior Member Posts: 1,183 Joined: Dec 2013
RE: Solution to the problem of pre-assigned variables to 0
Hello, Han, I do not propose to change the design, but to improve it, with the idea I propose it would be integrated NUM mode (HOME) with CAS MODE, since the idea is to use the same variables for example to expose a graphic analysis [PLOT], analysis numerical [NUM key] with symbolic analysis [CAS], simply defining the type of variable to symbolic (CAS mode) and then restart ([HOME MODE]).

sample:

Likewise MATLAB works, this was born as a numerical software, but they incorporated the symbolic calculation engine (Maple, then MuPAD) and everything operates very well integration between NUM / CAS mode

PHP Code:
x=-5: 0.0001: 5;y =x .^ 3 - 3 .* x .^ 2- 9 .*x + 2 plot (x,y),grid;p = [1, -3, -9,2] r1 = roots (p);syms x;         % assume x as symbolic varf = x^3-3*x^2-9*x+2 D=diff(f) % 3*x^2-6*x-9

LO SUFICIENTEMENTE BUENO ES ENEMIGO DE LA EXCELENCIA.
 « Next Oldest | Next Newest »

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