Post Reply 
2021: Examples of CAS-type programs
05-09-2021, 10:21 PM (This post was last modified: 06-21-2021 09:07 PM by compsystems.)
Post: #14
RE: 2021: Examples of CAS-type programs
Hello
trying the following code I have problems

PHP Code:
#cas
test_withsqrt_flag():=
begin
  local poly1
;
  
purge(x); PRINT(); print:
  
poly1 := x^-4*x^-7*x^-41*x^-4*x+35;
  print( 
factorpoly1 ) ); // (x+1) * (x^2-7*x+5) * (x^2+2*x+7) 
// or (x+(-√29-7)/2) * (x+(√29-7)/2)*(x+1) * (x^2+2*x+7) 
// depending on the square root flag it is activated or not manually.
  
return poly1;
end
test_withsqrt_flag() [enter] "Error: Bad Argument Value". Why?
do you have this problem on your calculator?

Now I want in the hp-prime to automate the factoring output without asking the user to change the flag manually

Xcas Code
PHP Code:
test_withsqrt_flag(x):=
{
  
local poly1;
  
purge(x);
  
with_sqrtFalse ); 
  
poly1 := x^-4*x^-7*x^-41*x^-4*x+35;
  print( 
factorpoly1 ) ); // (x+1) * (x^2-7*x+5) * (x^2+2*x+7)
  
with_sqrtTrue );  
  print( 
factorpoly1 )); // (x+(-√29-7)/2) * (x+(√29-7)/2)*(x+1) * (x^2+2*x+7) 
  
return poly1;
}; 

[Image: with_sqrt_flag_image00.jpg]
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: 2021: Examples of CAS-type programs - compsystems - 05-09-2021 10:21 PM



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