printf: 2D print

Messages in english

Modérateur : xcasadmin

Répondre
compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

printf: 2D print

Message par compsystems » lun. mars 12, 2018 11:09 pm

Hello BP
I do not see the 2D print, Why?

Code : Tout sélectionner

f():={
  print(sqrt(2));
  printf(sqrt(2));
  return "Done";
}:;

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: printf: 2D print

Message par parisse » mar. mars 13, 2018 11:59 am

2d printing is visible in the console (at the bottom) in Xcas for Firefox and in DispG() screen in Xcas native.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: printf: 2D print

Message par compsystems » mar. mars 13, 2018 3:26 pm

Some suggestions for DispG window:

1: On the first print delete the message "Step by step console"
2: Allow the ClrIO command to clean the print history
3: the impression of the last line must move the previous ones, so that it can be visualized in real time

Thanks

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: printf: 2D print

Message par parisse » mar. mars 13, 2018 4:19 pm

Ok for supporting ClrIO, but I won't change anything else in DispG in Xcas native.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: printf: 2D print

Message par compsystems » mar. mars 13, 2018 8:20 pm

thanks, with the ClrIO command, the screen is automatically cleaned

There is a simple problem, the printing is superimposed (you have to increase the line spacing =) ), please try the following code,
sol_sys1():={
local y,x,list0,expr0,lsolx,y1,y2,sols,test1;
purge(x,y);
autosimplify(nop); autosimplify();
approx_mode(0); approx_mode();
DispG; ClrIO; printf("Solving a system of two equations"); printf("Solve the following system:");
list0 := [ y = x^2, y = 2*x + 3 ]; 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*x + 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)=0, part(left(expr0),2)=0 ]; printf(lsolx);
printf("First factor plus 3, second minus 1:");
lsolx := [lsolx(1)+3, lsolx(2)-1 ]; 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([ y = x^2, y = 2*x + 3 ],[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);
return("Done");
}:;
I think that to take better advantage of the console space, please align to the left

Thank you very much

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: printf: 2D print

Message par parisse » mar. mars 13, 2018 8:56 pm

Run it inside Xcas for Firefox. As I said, I won't make UI changes in Xcas native. The future of Xcas native is for intensive computations where Xcas for Firefox would be too slow.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: printf: 2D print

Message par compsystems » ven. mars 23, 2018 10:03 pm

Hello BP, the future of the app are online app, but on-line_xcas is in development, while the PC version, usually works well and is already "ready"

I think it will not change anything in the UI, at least correct BUGS in the same

when running the next program, the super indexes are superimposed, the bug is solved simply by increasing the line spacing, maybe the something simple on source-code, or maybe this involves modifying 100s the code lines.

Code : Tout sélectionner

sol_sys1():={
local y,x,list0,expr0,lsolx,y1,y2,sols,test1;
purge(x,y);
autosimplify(nop); autosimplify();
approx_mode(0); approx_mode();
DispG; ClrIO; printf("Solving a system of two equations"); printf("Solve the following system:");
list0 := [ y = x^2, y = 2*x + 3 ]; 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*x + 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)=0, part(left(expr0),2)=0 ]; printf(lsolx);
printf("First factor plus 3, second minus 1:");
lsolx := [lsolx(1)+3, lsolx(2)-1 ]; 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([ y = x^2, y = 2*x + 3 ],[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"); 
}:;

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: printf: 2D print

Message par parisse » dim. mars 25, 2018 7:55 pm

Unfortunately, the widget used for the step by step console is the same as for displaying matrices, changing anything there would certainly have bad side effects.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re:

Message par compsystems » sam. avr. 14, 2018 3:48 pm

An idea, to avoid the superposition of lines automatically print a blank line after each impression.

printf("");

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: printf: 2D print

Message par compsystems » sam. avr. 21, 2018 3:43 pm

parisse a écrit :Ok for supporting ClrIO
ClrIO is not working

Code : Tout sélectionner

printf(x^2);printf(x/y);Pause;ClrIO;
xcas has commands similar to ClrHome (ClrWorkSheet)? http://tibasicdev.wikidot.com/68k:clrdraw

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re:

Message par parisse » sam. avr. 21, 2018 4:25 pm

It works on linux with 1.4.9-59, maybe binaries are not updated for win and mac.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re:

Message par compsystems » sam. avr. 21, 2018 4:42 pm

the last windows version throws giac 1.4.9-57.

It is possible that the graph DispG; plot(x-1/6*x^3,x); is only drawn in the DispG window and not in the worksheet?, since it does not make sense to see the graph in two parts,DispG window and worksheet window.

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re:

Message par parisse » sam. avr. 21, 2018 5:30 pm

No. The worksheet should be the place where all happens, you should not use DispG, it's here only for compatibility.

compsystems
Messages : 562
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re:

Message par compsystems » sam. avr. 21, 2018 5:42 pm

^
you believe that a clrHome command is important to clean the worksheet?

parisse
Messages : 5739
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re:

Message par parisse » sam. avr. 21, 2018 6:27 pm

What do you mean by clearing the worksheet?

Répondre