autosimplify(#) and print/printf
Publié : lun. juil. 30, 2018 1:46 pm
Hello, Mr. Bernard.
Why do the print and printf commands not read the value of the autosimplify flag?
with print
with printf
test_simplify_flag(); print (-2*x-3+x^2) = (2*x+3-2*x-3) and not x²-2*x-3= 0
Why do the print and printf commands not read the value of the autosimplify flag?
with print
Code : Tout sélectionner
test_simplify_flag():={
local list0,expr0;
local x, y;
assume( x, symbol ); // purge(x);
assume( y, symbol ); // purge(y);
autosimplify(2); // nop=none, 1=regroup, 2=simplify
print;
print("Solving a system of two equations.
Solve the following system [ y=x², y=2x+3 ]");
list0 := [ y = x^2, y = 2*x + 3 ]; print(list0);
print(""); print("> substitute y = x² in y = 2·x + 3");
expr0 := subst(list0(2),list0(1)); print(expr0);
print(""); print("> substract 2·x + 3");
expr0 := expr0-(2*x + 3); print(expr0);
Return "Done";
}:;
Code : Tout sélectionner
test_simplify_flag():={
local list0,expr0;
local x, y;
assume( x, symbol ); // purge(x);
assume( y, symbol ); // purge(y);
autosimplify(2); // nop=none, 1=regroup, 2=simplify
DispG; ClrIO;
printf("Solving a system of two equations.
Solve the following system [ y=x², y=2x+3 ]");
list0 := [ y = x^2, y = 2*x + 3 ]; printf(list0);
printf(""); printf("> substitute y = x² in y = 2·x + 3");
expr0 := subst(list0(2),list0(1)); printf(expr0);
printf(""); printf("> substract 2·x + 3");
expr0 := expr0-(2*x + 3); printf(expr0);
Return "Done";
}:;