## [Reduce-algebra-developers] Bug in sum?

 [Reduce-algebra-developers] Bug in sum? From: Simon Weitzhofer - 2012-08-23 16:55:21 ```Hi, Evaluating > on rounded; > sum(x**0.5,x,1,2) yields an error: ++++ Attempt to take car of an atom +++++ Error: Attempt to take car of an atom The problem seems to be the function freeof-dfl(u,v) in the file sum.red since defining symbolic procedure freeof!-dfl(u, v); if null u or atom u then t else freeof!-df(car u,v) and freeof!-dfl(cdr u,v); instead of symbolic procedure freeof!-dfl(u, v); if null u then t else freeof!-df(car u,v) and freeof!-dfl(cdr u,v); solves the problem. Best wishes, Simon ```

 [Reduce-algebra-developers] Bug in sum? From: Simon Weitzhofer - 2012-08-23 16:55:21 ```Hi, Evaluating > on rounded; > sum(x**0.5,x,1,2) yields an error: ++++ Attempt to take car of an atom +++++ Error: Attempt to take car of an atom The problem seems to be the function freeof-dfl(u,v) in the file sum.red since defining symbolic procedure freeof!-dfl(u, v); if null u or atom u then t else freeof!-df(car u,v) and freeof!-dfl(cdr u,v); instead of symbolic procedure freeof!-dfl(u, v); if null u then t else freeof!-df(car u,v) and freeof!-dfl(cdr u,v); solves the problem. Best wishes, Simon ```
 Re: [Reduce-algebra-developers] Bug in sum? From: Arthur Norman - 2012-08-23 19:25:11 ```Thank you for both the bug report and for pointing out exactly where something needed changing. The problem arose because a floating point number ends up represented internally by something that is a "sort of" prefix form but the data in it is chain terminating on a number not on "nil". So freeof!-dfl [as you observed] crashed on it. I have checked in a varient on your correction - hope that now works better for you. Arthur On Thu, 23 Aug 2012, Simon Weitzhofer wrote: > Hi, > > Evaluating > > > on rounded; > > sum(x**0.5,x,1,2) > > yields an error: > > ++++ Attempt to take car of an atom > > +++++ Error: Attempt to take car of an atom > > The problem seems to be the function freeof-dfl(u,v) in the file sum.red > since defining > > symbolic procedure freeof!-dfl(u, v); > if null u or atom u then t else freeof!-df(car u,v) and > freeof!-dfl(cdr u,v); > > instead of > > symbolic procedure freeof!-dfl(u, v); > if null u then t else freeof!-df(car u,v) and freeof!-dfl(cdr u,v); > > solves the problem. > > Best wishes, > Simon > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Reduce-algebra-developers mailing list > Reduce-algebra-developers@... > https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers > ```
 Re: [Reduce-algebra-developers] Bug in sum? From: Rainer Schöpf - 2012-08-23 20:08:56 ```On Thu, 23 Aug 2012 at 20:24 +0100, Arthur Norman wrote: > Thank you for both the bug report and for pointing out exactly where > something needed changing. The problem arose because a floating point > number ends up represented internally by something that is a "sort of" > prefix form but the data in it is chain terminating on a number not on > "nil". So freeof!-dfl [as you observed] crashed on it. Umm. This gets around the crashing, but freeof!-df doesn't process correctly special prefix forms in its first parameter. Consider: load_package sum; operator f; lisp freeof!-df(aeval '(df (f u v) u v),'v); % -> t lisp freeof!-df(reval '(df (f u v) u v),'v); % -> nil although both should evaluate to nil. So I propose something like symbolic procedure freeof!-df(u, v); % check u contains differential operator with respect to v; if atom u or car u eq '!:dn!: or get(car u,'dname) then t else if car u eq '!*sq then freeof!-df(prepsq cadr u,v) else if car(u) eq 'df then freeof!-df(cadr u,v) and not smember(v,cddr u) else freeof!-dfl(cdr u,v); Rainer ```