 Step-by-step programs in CAS - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Step-by-step programs in CAS (/thread-7549.html) Step-by-step programs in CAS - compsystems - 01-10-2017 05:43 PM Hello, I'm trying the following code (Step-by-step), but I see something strange in the output, please run the following program PHP Code: `#cas    testInequality1():=    begin     local expr0;     print;     print("step1:");     expr0 := '(3*x^2-2*x-2) < (2*x^2-3*x+4)';     //expr0 :=  (3*x^2-2*x-2) < (2*x^2-3*x+4);     print(string(expr0));      print("");     print("step2: +(-2*x^2)");     expr0 := expr0 + -2*x^2;     print(string(expr0));      expr0 := simplify(expr0); // Requires a sentence more, of simplification.     print("simplify → " +expr0);     print("");     print("step3: +(3*x)");     expr0 := expr0 + 3*x;     print(string(expr0));      expr0 := simplify(expr0);      print("simplify → "+expr0);     print("");     print("step4: +(-4)");     expr0 := expr0 + -4;     print(string(expr0));      expr0 := simplify(expr0);      print("simplify → "+expr0);     print("");#end ` testInequality(); [ expr0: (--­4+4)>(x^2+x--­4-2) left: --­4+4 right: x^2+x--­4-2 ] This is expected [0>(x^2+x-6), 0, x^2+x-6] RE: Step-by-step programs in CAS - Han - 01-10-2017 05:56 PM (01-10-2017 05:43 PM)compsystems Wrote:  Hello, I'm trying the following code (Step-by-step), but I see something strange in the output, please run the following program PHP Code: `#cas    testInequality():=    begin     local expr0;     print("");     expr0 := '(3*x^2-2*x-2) < (2*x^2-3*x+4)';     //expr0 := (3*x^2-2*x-2) < (2*x^2-3*x+4);     print("step1: " + expr0);     expr0 := expr0  -2*x^2;      print("step2: " + expr0); expr0 := simplify(expr0); print("simplify ⇨ "+expr0);     expr0 := expr0 + 3*x;     print("step3: " + expr0); expr0 := simplify(expr0); print("simplify ⇨ "+expr0);     expr0 := expr0  -­4;     print("step4: " + expr0); expr0 := simplify(expr0); print("simplify ⇨ "+expr0);     //return expr0;     return [ expr0, left(expr0), right(expr0) ];    end;#end ` testInequality(); [ expr0: (--­4+4)>(x^2+x--­4-2) ? left: --­4+4 ? right: x^2+x--­4-2 ? ] This is expected [0>(x^2+x-6), 0, x^2+x-6] When I copied your code, the "-" symbol in front of the 4 (in "step 4") was translated to two dashes: --4. Perhaps your editor is not using the correct symbol for subtraction. RE: Step-by-step programs in CAS - compsystems - 01-10-2017 06:57 PM Thanks Han, (Updated above code), The problem was that when porting a code from ti68k, which uses the character #173 (-) as a change of sign, That is not the change of sign in the hp-prime PHP Code: `// ti68kinequali()Prgm Local expr0 ClrIO Disp "step1: " 3*x^2-2*x-2 < 2*x^2-3*x+4 → expr0 Disp expr0 Disp "step2: +(-­2*x^2)" expr0 + ­2*x^2 → expr0 Disp expr0 Disp "step3: +3*x" expr0 + 3*x → expr0 Disp expr0 Disp "step4: +(-­4)": Pause expr0 + -­4 → expr0 Disp expr0EndPrgm `