Post Reply 
printing in 2D (TEXTBOOK)
03-21-2018, 07:10 PM (This post was last modified: 03-21-2018 07:49 PM by compsystems.)
Post: #1
printing in 2D (TEXTBOOK)
Hello, the Xcas, has an cmd to print in 2D printf(),

one of the missing features to incorporate in the firmware of the hp-prime, which is available in ti68k since 1995 (ti92)





xcas examples

PHP Code:
DispGClrIOa:=4b:=2.5printf("sqrt(%gen)+(%gen)^2=%gen",a,b,sqrt(a)+b^); PauseDispHome

PHP Code:
testPrint2D_e1():={
        
local x,y;
        
assume(x,symbol);assume(y,symbol);
        
autosimplify(nop);
        
DispG
        
printf
        
printf"Console, 2D printing" ); Pause;
        
printf"" );
        
printf"Expr1:" ); 
        
printf'f(x):=x^3-2*x^2+1*x-1' ); Pause;
        
printff(x):=x^3-2*x^2+1*x-); Pause;
        
printff(x) ); Pause;;
        
        
printf"" );
        
printf"Expr2:" ); 
        
printf'x^3-2*x^2+1*x-1 | x=y' Pause;
        
printfx^3-2*x^2+1*x-x=); Pause;
        
printff(y) ); Pause;;
        
        
printf"" );
        
printf"Expr3:" );
        
printf'g(x):=1/(x+3)' ); Pause;
        
printfg(x):=1/(x+3) ); Pause;
        
printfg(x) ); Pause;
   
        
printf"" );     
        
printf"Expr4:" );
        
printf'f(g(x))' ); Pause;
        
printff(g(x)) ); Pause;

        
printf"" );     
        
printf"Expr5:" );        
        
printf'g(f(x))' ); Pause;
        
printfg(f(x)) ); Pause;
        
// DispHome 
        
return "Done"
       
}:; 

PHP Code:
testPrint2D_e2():={
   
local y,x,list0,expr0,lsolx,y1,y2,sols,test1;
   
purge(x,y);
   
autosimplify(nop); autosimplify();
   
approx_mode(0); approx_mode();
   
DispGClrIOprintf("Solving a system of two equations"); printf("Solve the following system:");
   
list0 := [ x^22*]; printf(list0);
   
printf("substitute y = x² in y = 2x + 3:");
   
expr0 := subst(list0(2),list0(1)); printf(expr0);
   
printf("substract 2x + 3:");
   
expr0 := expr0-(2*3); printf(expr0);
   
printf("simplify:");
   
expr0 := simplify(expr0); printf(expr0);
   
printf("factor:"); 
   
expr0 := factor(expr0); printf(expr0);
   
printf("zero factor theorem:"); 
   
lsolx := [ part(left(expr0),1)=0part(left(expr0),2)=]; printf(lsolx);
   
printf("First factor plus 3, second minus 1:");
   
lsolx := [lsolx(1)+3lsolx(2)-]; printf(eval(lsolx,1));
   
printf("simplify"); printf("x values:");
   
lsolx := simplify(lsolx); printf(lsolx);
   
printf("y values:"); printf("Replace x values in the system, firts equation"); 
   
y1 := subst(list0(1),lsolx(1)); printf(y1);
   
printf("Replace x values in the system, second equation");
   
y2 := subst(list0(1),lsolx(2)); printf(y2);
   
printf("Solutions shaped as a array");
   
sols:=[[lsolx(1),y1],[lsolx(2),y2]]; printf(sols); 
   
printf("Checking results:"); printf("Replace x and y values in the system, firts equation"); 
   
test1 := subst(list0(1),[sols(1,1),sols(1,2)]); printf(test1);
   
printf("Evaluate:");
   
test1 := evalb(test1); printf(test1);
   
printf("Replace x and y values in the system, second equation"); 
   
test1 := subst(list0(1),[sols(2,1),sols(2,2)]); printf(test1); 
   
printf("Evaluate:");
   
test1 := evalb(test1); printf(test1);
   
sols := solve([ x^22*],[x,y]); printf("Solutions:"); printf(sols);
   
printf("Solutions shaped as a boolean expression:");
   
sols := list2exp(sols,[x,y]); printf(eval(sols,1));
   
printf("Graphing"); 
   
plot([x^2,2*x+3],x); 
   
// DispHome 
   
return("Done"); 
}:; 

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




User(s) browsing this thread: