From: Simon Weitzhofer <simon@ge...>  20110719 13:09:33

Hello, my name is Simon Weitzhofer and I'm working on the GeoGebra project (www.geogebra.org), a educational mathematic software. We are going to use the java version of reduce for the next version of GeoGebra and now I ran into a problem with expanding an expression. The goal is to expand the term 1.2*x*(x+1). The expected result is 1.2*x^2+1.2*x. With switch pri set to on the result is 1.2*x*(x + 1), with switch pri off the result is (:rd: . 1.2)*x^2 + (:rd: . 1.2)*x. (rounded is set to on and roundall, numval to off). Any idea how to get rid of the :rd: thing or another way to expand this expression? Thank you, Simon 
From: Rainer Schöpf <rainer.schoepf@gm...>  20110719 14:29:07

On Tue, 19 Jul 2011 at 14:47 +0200, Simon Weitzhofer wrote: > my name is Simon Weitzhofer and I'm working on the GeoGebra project > (www.geogebra.org), a educational mathematic software. We are going to use > the java version of reduce for the next version of GeoGebra and now I ran > into a problem with expanding an expression. > > The goal is to expand the term 1.2*x*(x+1). The expected result is > 1.2*x^2+1.2*x. With switch pri set to on the result is 1.2*x*(x + 1), with > switch pri off the result is (:rd: . 1.2)*x^2 + (:rd: . 1.2)*x. (rounded is > set to on and roundall, numval to off). > Any idea how to get rid of the :rd: thing or another way to expand this > expression? (:rd: . 1.2) is the internal representation of the rounded number 1.2. The expression is expanded correctly, but printed incorrectly, ie. it is a bug in the part of the printer that is exercised when the switch pri is off. I have a preliminary correction for this; it isn't really tested right now, but apparently solves your problem. Redefine the procedure xprint as symbolic procedure xprint(u,flg); % U is a standard term. % Flg is a flag which is true if a term has preceded this term. % Procedure prints the term and returns NIL. begin scalar v,w; v := tc u; u := tpow u; if (w := kernlp v) and w neq 1 then <<v := quotf(v,w); if minusf w then <<oprin 'minus; w := !:minus w; flg := nil>>>>; if flg then oprin 'plus; if w and w neq 1 then <<if domainp w then maprin w else prin2!* w; oprin 'times>>; xprinp u; if v neq 1 then <<oprin 'times; xprinf(v,red v,nil)>> end; by adding this code to your input. I will test this further before committing the update. (To other developers: given that the value of variable w can be an arbitrary domain element, shouldn't the comparisons of w to 1 better be done by calling !:onep on it?) Regards, Rainer 
From: Ted Kosan <ted.kosan@gm...>  20110722 21:39:29

Rainer wrote: >> (:rd: . 1.2) is the internal representation of the rounded number 1.2. The >> expression is expanded correctly, but printed incorrectly, ie. it is a bug in >> the part of the printer that is exercised when the switch pri is off. > > I have a preliminary correction for this; it isn't really tested right now, but > apparently solves your problem. Redefine the procedure xprint as > > symbolic procedure xprint(u,flg); > % U is a standard term. > % Flg is a flag which is true if a term has preceded this term. > % Procedure prints the term and returns NIL. > begin scalar v,w; > v := tc u; > u := tpow u; > if (w := kernlp v) and w neq 1 > then <<v := quotf(v,w); > if minusf w > then <<oprin 'minus; w := !:minus w; flg := nil>>>>; > if flg then oprin 'plus; > if w and w neq 1 > then <<if domainp w then maprin w else prin2!* w; oprin 'times>>; > xprinp u; > if v neq 1 then <<oprin 'times; xprinf(v,red v,nil)>> > end; > > by adding this code to your input. > > I will test this further before committing the update. Thank you very much for coming up with a solution to this problem. Ted 
From: Rainer Schöpf <rainer.schoepf@gm...>  20110721 16:21:30

Hello Simon, concerning the problem you reported two days ago: > The goal is to expand the term 1.2*x*(x+1). The expected result is 1.2*x^2+1.2*x. > With switch pri set to on the result is 1.2*x*(x + 1), with switch pri off the result is (:rd: . 1.2)*x^2 + (:rd: . 1.2)*x. > (rounded is set to on and roundall, numval to off). I checked in a correction and confirmed that a freshly built Java version of REDUCE does no longer exhibit the problem. Rainer 