HP Forums
real math print: printf Xcas cmd 3/4 → ¾ - 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: real math print: printf Xcas cmd 3/4 → ¾ (/thread-12419.html)



real math print: printf Xcas cmd 3/4 → ¾ - compsystems - 02-13-2019 03:16 PM

Hello
Xcas has a function to print in prettyprint (2D) very important to show equations and results as in textbooks, please hpprime develop group incorporate this function

PHP Code:
function area_of_the_triangle()
begin 

                local Base
HeightAnswer;

                
assume(Base,float);

                
assume(Height,float);

                
assume(Answer,float);


                
DispGClrGraphClrIO;


                
printf"Please enter the base of the triangle" );

                
inputBase );


                
printf"Please enter the height of the triangle" );

                
inputHeight );


                
Answer := * (Base Height);

                
printf"The area of the triangle is %gen "Answer )
                print( 
"The area of the triangle is "Answer )

                
printfx^);  // x²
                
print( x^); // x^2

                
return Done;

ffunction

area_of_the_triangle() [enter] then 1/2 then 3 returns in pretty print
"The area of the triangle is ¾"

with print cmd ( print lineary) returns

"The area of the triangle is 3/4"


[enter]


RE: printf cmd 3/4 → ¾ - compsystems - 02-14-2019 12:42 AM

Another example

PHP Code:
testPrintformat():={
  
local f,SlopeRootsAreaxpos(a)pos﹝b﹞;
  
  
assume(x,symbol);
  
  
DispGClrIO;
  
f(x):=-2*x^2-4*x+12;
  
printf("f(x):%gen",f(x));
  
  
Slope:=unapply(diff(f(x),x),x);
  
printf("Slope:∂xfx)=%gen",right(Slope));
  
  
pos(a):=-4;  print(pos(a));
  
pos﹝b﹞:=-1;  print(pos﹝b﹞);

  print(
Slope(pos(a)));  
  print(
Slope(pos﹝b﹞)) 

    
  
Roots:=solve(f(x)=0,x);
  
printf("Roots:%gen ~ %gen"Rootsapprox(Roots)); 
  
  
Area:=int(f(x),x,Roots(1),Roots(2));
  
printf("Area:%gen ~ %gen"Areaapprox(Area)); 
  return 
"Done";
}:; 

test online Xcas