^ ok in online version
in the following code the output of the roots are printed as list[], I would like to see the printf (prettyprint) impression of list[ ] as { }
Code : Tout sélectionner
testPrintformat():={
local f, Slope, Roots, Area, x;
assume(x,symbol);
ClrIO;
f(x):=-2*x^2-4*x+12;
printf("f(x):%gen",f(x));
Slope:=unapply(diff(f(x),x),x);
printf("Slope:∂xf(x)=%gen",right(Slope));
Roots:=solve(f(x)=0,x);
printf("Roots:%gen ~ %gen", Roots, approx(Roots));
Area:=int(f(x),x,Roots(1),Roots(2));
printf("Area:%gen ~ %gen", Area, approx(Area));
return "Done";
}:;
testPrintformat() [enter]
f(x): -2 x^2-4x+12
Slope: ∂xf(x)=-4x-4
Roots: list[sqrt(-7)-1,sqrt(7)-1] ~ list[-3.64575131106,1.64575131106]
Area: -1/3×(-28*sqrt(7)-40 )+1/3×(28*sqrt(7)-40) ~ 49.3873578065
PD: when copying the output to the clipboard, the sqrt() function and ^ operator is not added
f(x): -2 x2-4x+12
Slope: ∂xf(x)=-4x-4
Roots: list[-7-1,7-1] ~ list[-3.64575131106,1.64575131106]
Area: -13× (-287-40 )+13× (287-40 ) ~ 49.3873578065