flag to deactivate (=) => (==)

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

flag to deactivate (=) => (==)

Message par compsystems » sam. juil. 28, 2018 4:09 am

Hello, Bernard, some procedures in the hp-prime do not return the desired, due to the problem of pre-assigning variables to zero value

example

Code : Tout sélectionner

X, Y RETURNS 0,0
V1(X,Y):=X-2*Y=7; V2(X,Y):=5*X-3*Y=2; returns [0,0]  
  0-2*0=7, 5*0-3*0=2
  0=7, 0=2
  0/FALSE, 0/FALSE
   

A possible solution is that the operator (=) does not act as a comparison operator, this could be done using a flag to deactivate it.

Code : Tout sélectionner

EXPORT plotGraphParHome()
BEGIN
	LOCAL Symbolic_sview:=0;
	LOCAL Plot_sview:=1; 
	LOCAL Numeric_sview:=2;
	LOCAL SymbolicSetup_sview:=3;
	LOCAL PlotSetup_sview:=4;
	LOCAL NumericSetup_sview:=5;
		   
	STARTAPP("Parametric");
	Parametric.X1:='T^2';
	Parametric.Y1:='T';
	Parametric.CHECK(1);
	STARTVIEW(Plot_sview);
	RETURN "Done";
END;


#cas
	plotGraphParCAS():=
	BEGIN
		LOCAL Symbolic_sview:=0;
		LOCAL Plot_sview:=1; 
		LOCAL Numeric_sview:=2;
		LOCAL SymbolicSetup_sview:=3;
		LOCAL PlotSetup_sview:=4;
		LOCAL NumericSetup_sview:=5;
		PURGE(T);
		STARTAPP("Parametric");
		X1(T):=T^2;
		Y1(T):=T;
		CHECK(1);
		STARTVIEW(Plot_sview);
		RETURN "Done";
	END;
#end


EXPORT plotAdvGraphHOME()
BEGIN
	LOCAL Symbolic_sview:=0;
	LOCAL Plot_sview:=1; 
	LOCAL Numeric_sview:=2;
	LOCAL SymbolicSetup_sview:=3;
	LOCAL PlotSetup_sview:=4;
	LOCAL NumericSetup_sview:=5;
		   
	STARTAPP("Advanced Graphing");
	V1:='X-2*Y=7'; 
	V2:='5*X-3*Y=2';
	CHECK(1);CHECK(2);
	STARTVIEW(Plot_sview);
	RETURN "Done";
END;

#cas
	plotAdvGraphCAS():=
	BEGIN
		LOCAL Symbolic_sview:=0;
		LOCAL Plot_sview:=1; 
		LOCAL Numeric_sview:=2;
		LOCAL SymbolicSetup_sview:=3;
		LOCAL PlotSetup_sview:=4;
		LOCAL NumericSetup_sview:=5;
		PURGE(X,Y);
		STARTAPP("Advanced Graphing");
		V1(X,Y):=X-2*Y=7; 
		V2(X,Y):=5*X-3*Y=2;
		CHECK(1);CHECK(2);
		STARTVIEW(Plot_sview);
		RETURN "Done";
	END;
#end

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: flag to deactivate (=) => (==)

Message par parisse » sam. juil. 28, 2018 5:53 pm

Don't use HP reserved variables...

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: flag to deactivate (=) => (==)

Message par compsystems » ven. août 03, 2018 9:40 pm

Hello, if the code requires graphing, the only way is to use the reserved variables. Adding this flag avoids many problems, and warning messages. I think it's very important to add this flag

parisse
Messages : 5743
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: flag to deactivate (=) => (==)

Message par parisse » dim. août 05, 2018 7:53 pm

Why? You can use Giac native plot instructions like plotfunc, plotparam, etc.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: flag to deactivate (=) => (==)

Message par compsystems » sam. sept. 01, 2018 11:17 am

Hello, BP, I refer to xcas on the hp-prime, also using xcas-pc
I ask the student to enter expressions on the worksheet and sometimes to made comparison of expressions. By means of a flag we expand in the power of manipulation and interpretation.

Répondre