Post Reply 
Fibonacci sequence by recursive algorithm fail
04-21-2015, 04:00 PM
Post: #11
RE: Fibonacci sequence by recursive algorithm fail
(04-21-2015 02:20 PM)compsystems Wrote:  
(04-21-2015 01:57 PM)DrD Wrote:  I think a case could be made that a CAS program is not a good construct for this kind of algorithm. Personally, I think that CAS programs are better suited for CAS exclusive purposes (remaining within the CAS environment).

Just to use one type CAS program if the output is symbolic is obligatory, if only numerical output is optional

For example the following code can not code as HOME program

Code:
#CAS
     printSymbolic Algebraic ():=
     BEGIN
         // versión 0.0.1 April 14 2015 for HP-Prime by compSystems
         print; //© Clear Terminal Window (I/O)
         print( "hpPrime Terminal View, Symbolic Algebraic Printing" );
         print( "" );
         print( "Expr1:" ); f(x):=x^3-2*x^2+1*x-1;
         print( x^3-2*x^2+1*x-1 );
         print( f(x) );
         
         print( "" );
         print( "Expr2:" );
         print( x^3-2*x^2+1*x-1 | x=y );
         print( f(y) );
         
         print( "" );
         print( "Press any key to continue" ); freeze; wait;
         print( "Expr3:" ); g(x):=1/(x+3);
         print( g(x) );
         
         print( "Expr4:" );
         print( "f(g(x))=" );
         print( f(g(x)) );
         
         print( "g(f(x))=" );
         print( g(f(x)) );
          
         print( "Expr4:");
         print( (x^4-x^3-6*x^2+11*x-6)/x^6+(x^3-6*x^2+11*x-6 | x=y) );
         return "Done"
     END;
 #end

For me it is not completely clear what you are trying to do. However, I synthesized your larger program into just this fragment, which (I think) is what you may be asserting, and it IS in HOME mode. The general idea is interaction with string / expression / number. You can accomplish the rest of your program with similar workflow:

Code:

EXPORT Algy()
BEGIN
  local x:=3;  //  Just making an example here

// versión 0.0.1 April 14 2015 for HP-Prime by compSystems  
  print(); //© Clear Terminal Window (I/O)
  print("hpPrime Terminal View, Symbolic Algebraic Printing");
  print("");

  //  <<  Cut larger portion of your program to only Expr1 fragment >>
  //  <<  You can build on this theme, if it is suitable.                      >>
  //  <<  I think this may be the general idea you're after(?)            >>

  Expr1:="x^3-2*x^2+1*x-1"; 
  print(Expr1+ " "+" = "+EXPR(Expr1));  // EXPR is in help doc's

  //  Of course, you can perform ANY defined operation(s), the above is just an example.

  return "Done";
END;
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Fibonacci sequence by recursive algorithm fail - DrD - 04-21-2015 04:00 PM



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