Re: [fricas-devel] meaning of %
The question is whether % refers to the value of the last line (A) or to the value of the last evaluated expression (B). Mathematica and Axiom use semantics (A), Maple uses (B). I expected (B), i.e. x3=102. Well, 'x2 := 2*%; x3 := 100+%;' is a single expression, so really no difference in this case if you say "expression" or "line". In fact, in files you may have multiline expressions, so saying "expression" is more precise. Well, I know that there are compound expressions, but up to now an expression for me ended at ";". In fact, what you describe is (x2 := 2*%; x3 := 100+%) with the parentheses to make it into a compound expression. But even with parens I wouldn't have a clue what % refers to if it is not precisely specified. It is not necessarily clear, that the second % refers to the same value as the first %, except if one claims that a compound statement basically behaves like a function with % as a parameter. Looks like this is exactly what FriCAS does. %%% (10) -> x1 := 1 (10) 1 Type: PositiveInteger %%% (11) -> for i in 1..2 repeat (x2:=x1+%;x3:=5*%) Type: Void %%% (12) -> [x1,x2,x3] (12) [1, 2, 5] Maple gives something else. > x1:=1; x1 := 1 > for i from 1 to 2 do x2:=x1+%; x3:=5*%; end do; x2 := 2 x3 := 10 x2 := 11 x3 := 55 > [x1,x2,x3]; [1, 11, 55] I just say, such example should be added to the book. I would prefer: x1 := 1 x2 := 2*%; x3 := 100 + % with explantation that the second line is a compound expression. So basically when pressing enter, then the whole thing that FriCAS receives is counted as one (maybe compound) expression and this whole thing is evaluated and its value is that of the last subexpression (in case it is compound). And % refers to the last evaluation, i.e. the value that was computed when the user pressed ENTER previously (with a non-trivial input). Maybe also for i in 1..2 repeat x2 := i*x2 as example of Void result. Good as an example, but I think that loops create Void values is described already somewhere. Ralf -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/ed761367-0c10-451d-9970-312b8c46496a%40hemmecke.org.
Re: [fricas-devel] meaning of %
On Mon, May 06, 2024 at 09:24:41PM +0200, Ralf Hemmecke wrote: > On 5/6/24 20:29, Waldek Hebisch wrote: > > On Mon, May 06, 2024 at 07:33:13PM +0200, Ralf Hemmecke wrote: > > > Who can guess what the output of (3) will be just from Section 1.3.2 of > > > the > > > Book? > > > > > > %%% (1) -> x1 := 1 > > > > > > (1) 1 > > > Type: PositiveInteger > > > %%% (2) -> x2 := 2*%; x3 := 100+%; > > > > > > Type: PositiveInteger > > > %%% (3) -> [x1,x2,x3] > > > > > > > Hmm, for me FriCAS produces expected result. And while I now > > have "insider knowledge" my expectations concerning previous > > result did not chage compared to my first contact with Axiom. > > What did you expect? > > The question is whether % refers to the value of the last line (A) or to the > value of the last evaluated expression (B). > Mathematica and Axiom use semantics (A), Maple uses (B). > > I expected (B), i.e. x3=102. Well, 'x2 := 2*%; x3 := 100+%;' is a single expression, so really no difference in this case if you say "expression" or "line". In fact, in files you may have multiline expressions, so saying "expression" is more precise. > I just say, such example should be added to the book. I would prefer: x1 := 1 x2 := 2*%; x3 := 100 + % with explantation that the second line is a compound expression. Maybe also for i in 1..2 repeat x2 := i*x2 as example of Void result. -- Waldek Hebisch -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/ZjkzD8_tfNO4VIUM%40fricas.org.
Re: [fricas-devel] meaning of %
On 5/6/24 20:29, Waldek Hebisch wrote: On Mon, May 06, 2024 at 07:33:13PM +0200, Ralf Hemmecke wrote: Who can guess what the output of (3) will be just from Section 1.3.2 of the Book? %%% (1) -> x1 := 1 (1) 1 Type: PositiveInteger %%% (2) -> x2 := 2*%; x3 := 100+%; Type: PositiveInteger %%% (3) -> [x1,x2,x3] Hmm, for me FriCAS produces expected result. And while I now have "insider knowledge" my expectations concerning previous result did not chage compared to my first contact with Axiom. What did you expect? The question is whether % refers to the value of the last line (A) or to the value of the last evaluated expression (B). Mathematica and Axiom use semantics (A), Maple uses (B). I expected (B), i.e. x3=102. I just say, such example should be added to the book. Ralf -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/1825a299-0604-45f8-a0f1-f8bbc8122a58%40hemmecke.org.
Re: [fricas-devel] meaning of %
On Mon, May 06, 2024 at 07:33:13PM +0200, Ralf Hemmecke wrote: > Who can guess what the output of (3) will be just from Section 1.3.2 of the > Book? > > %%% (1) -> x1 := 1 > >(1) 1 >Type: PositiveInteger > %%% (2) -> x2 := 2*%; x3 := 100+%; > >Type: PositiveInteger > %%% (3) -> [x1,x2,x3] > Hmm, for me FriCAS produces expected result. And while I now have "insider knowledge" my expectations concerning previous result did not chage compared to my first contact with Axiom. What did you expect? -- Waldek Hebisch -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/ZjkhhkFRdTDeBB-R%40fricas.org.
[fricas-devel] meaning of %
Who can guess what the output of (3) will be just from Section 1.3.2 of the Book? %%% (1) -> x1 := 1 (1) 1 Type: PositiveInteger %%% (2) -> x2 := 2*%; x3 := 100+%; Type: PositiveInteger %%% (3) -> [x1,x2,x3] Spoiler. FriCAS seems to have the same semantics as Mathematica (which is different from Maple). Ralf PS: I know, Qian can. -- You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/de322b9d-ab85-4973-85b8-0345889c041c%40hemmecke.org.