The following warnings occurred:
Warning [2] Undefined array key 255667 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 255669 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 255671 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 255680 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 255682 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 255690 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 255725 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 255682 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 255725 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 255690 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





Need CAS help



#2

Using CAS in programs is tricky. I need to store a value inside a CAS variable inside a program using variables local to the program or passed as parameters to the program, I've tried using the CAS command to no avail, since it evaluates to zero.

Assuming aaaa is a CAS variable and A,B,C are variables than have been assigned non-zero numeric values CAS("aaaa:=A*B*C") stores zero in aaaa, but CAS("aaaa:=2") stores the number 2. Also, if I store 2 in aaaa directly in CAS, it successfully retains this value in the program. So, basically, there seems to be no way to store computed values in a program in a CAS variable.


#3

Quote:
Using CAS in programs is tricky. I need to store a value inside a CAS variable inside a program using variables local to the program or passed as parameters to the program, I've tried using the CAS command to no avail, since it evaluates to zero.

Assuming aaaa is a CAS variable and A,B,C are variables than have been assigned non-zero numeric values CAS("aaaa:=A*B*C") stores zero in aaaa, but CAS("aaaa:=2") stores the number 2. Also, if I store 2 in aaaa directly in CAS, it successfully retains this value in the program. So, basically, there seems to be no way to store computed values in a program in a CAS variable.


You keep forgetting that the CAS currently does not recognize local variables. So CAS("aaaa:=A*B*C") actually creates a GLOBAL variable called aaaa and this GLOBAL variable will have the correct value. However, since local variables have higher priority, the LOCAL variable aaaa still has a value of 0 and that is what is visible to the program. So to do what you want, use:

aaaa:=CAS("A*B*C");

which takes the result of the CAS calculation A*B*C and saves it into the LOCAL variable aaaa.

Here's that old thread again :-)

Edited: 12 Nov 2013, 8:42 p.m.


#4

Thanks, but that doesn't solve my problem. It just creates a nul value in aaaa. I need this to be a CAS value not a local value.

Oh dear, now my calculator has crashed again, and I've lost my CAS history, variables, settings... What a pain this thing is to do anything.

Edited: 12 Nov 2013, 9:26 p.m.


#5

Quote:
Thanks, but that doesn't solve my problem. It just creates a nul value in aaaa. I need this to be a CAS value not a local value.

Oh dear, now my calculator has crashed again, and I've lost my CAS history, variables, settings... What a pain this thing is to do anything.


Are the variables aaaa, A, B,and C all global variables? or are they all local variables? or a mix? This makes a big difference.

If you are using A, B, and C as local variables, then that would not work in CAS. In general, I try to avoid using the built-in variables as local variables. Are you using EXPORT on aaaa or did you leave that out?

I am able to create a CAS variable just fine with

EXPORT TEST()
BEGIN
CAS("aaaa:=A*B*C");
END;

When I go into the memory browser, I see aaaa listed as a real value under the CAS variables. Its value is non-zero, provided that my A, B, and C built-in variables are non-zero. Perhaps there are details I am not understanding about your code.

Edited: 12 Nov 2013, 10:02 p.m.


#6

I'm afraid my calculator is broken again and may need another re-format, so I may just throw it out with tomorrow's trash pickup and cut my losses.

#7

Well, I've finally gotten everything to work, but it hasn't been easy. As you can see, my dilemma was getting CAS and non-CAS stuff to work together harmoniously inside a program. I'm creating and solving a symbolic expression, which contains coefficients that are evaluated at runtime to be used in the construction of the expression. All of this would be so much easier if there were some sort of CAS switch that could be enabled inside a program at runtime, i.e. CASmode(On || Off). Anyways, here's the code I've written; note the complete absence of LOCAL variables:

Program Beam

//Eigenvalue solver for root based on guess "G"
//The guess should be a positive number slightly larger than the lowest non-trivial (zero)
//root. If it is too low, the result will be a very small number representing zero. Once the lowest
//root is determined, the program can be run again w/o entering the beam data again to
//determine additional higher roots if needed, which will be stored in the matrix variable M0.
//Note that the natural frequencies are proportional to the square of the eigenvalues.
EXPORT Beam_Solve(guess)
BEGIN
G:=guess;
CAS("M0:=nSolve(DET(m1)=0,x=G)");
RETURN M0;
END;

//This program solves for the natural frequencies of a beam with flexible end supports
EXPORT Beam_Main(k1,k2,k3,k4,EI,m,L,guess)
BEGIN
//Dimensionless coefficients
A:=k1*L^3/EI;
B:=k2*L/EI;
C:=k3*L^3/EI;
D:=k4*L/EI;
//Create CAS matrix elements
CAS("a11_:=x^3");
CAS("a12_:=-A");
CAS("a13_:=-x^3");
CAS("a14_:=-A");
CAS("a21_:=-B");
CAS("a22_:=-x");
CAS("a23_:=-B");
CAS("a24_:=x");
CAS("a31_:=-x^3*COS(x)-C*SIN(x)");
CAS("a32_:=x^3*SIN(x)-C*COS(x)");
CAS("a33_:=x^3*COSH(x)-C*SINH(x)");
CAS("a34_:=x^3*SINH(x)-C*COSH(x)");
CAS("a41_:=-x*SIN(x)+D*COS(x)");
CAS("a42_:=-x*COS(x)-D*SIN(x)");
CAS("a43_:=x*SINH(x)+D*COSH(x)");
CAS("a44_:=x*COSH(x)+D*SINH(x)");
//Create CAS eigenvalue matrix
CAS("m1:=[[a11_,a12_,a13_,a14_],[a21_,a22_,a23_,a24_],[a31_,a32_,a33_,a34_],[a41_,a42_,a43_,a44_]]");
//Solve for eigenvalue based on guess
Beam_Solve(guess);
//Calculate natural frequency in Hz
L0:=sqrt(EI/m)*(M0/L)^2/(2*pi);
//Print eigenvalue and natural frequency
RETURN {M0,L0};
END;


Edited: 13 Nov 2013, 3:51 p.m.

#8

Hello,

export test(A,B,C)
begin
CAS.abcd:=A+B+C;
end;

seems to work. But I am not sure if it will work on your earlier revision. Can you please try it?

Else, you might want to try

export test(A,B,C)
begin
D:= A*B*C; // note the use of a GLOBAL temporary variable. you could use an exported variable also
CAS("abcd:=D");
end;


for your locking machine. did you try rebooting with backspace pressed? it might be enough to restart it. then erase the offending files...

Cyrille


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP Prime: CAS taylor Alberto Candel 5 3,861 12-13-2013, 09:45 PM
Last Post: Alberto Candel
  HP Prime CAS curiosity bluesun08 11 4,701 12-10-2013, 01:03 PM
Last Post: Han
  [HP-Prime CAS] "Warning, ^ (Command) Is ambiguous on non square matrices"?? CompSystems 1 2,129 12-07-2013, 07:15 PM
Last Post: CompSystems
  HP Prime: complex numbers in CAS. Alberto Candel 1 1,846 12-06-2013, 02:36 PM
Last Post: parisse
  [HP Prime] plotfunc() bug in CAS Chris Pem10 2 2,354 12-04-2013, 02:46 PM
Last Post: Chris Pem10
  HP Prime: Home/CAS? Alasdair McAndrew 11 3,767 11-26-2013, 02:48 PM
Last Post: Alberto Candel
  HP Prime numerical precision in CAS and HOME Javier Goizueta 5 2,342 11-16-2013, 03:51 AM
Last Post: Paul Dale
  HP Prime - CAS functions in Spreadsheet App CR Haeger 6 2,371 11-11-2013, 12:37 AM
Last Post: Michael de Estrada
  Another HP Prime CAS question Michael de Estrada 3 1,783 11-09-2013, 10:56 AM
Last Post: Michael de Estrada
  Trig vs hyperbolic handling differences in Prime CAS Michael de Estrada 3 1,521 11-08-2013, 06:26 PM
Last Post: Mark Hardman

Forum Jump: