Dear all, I am staring already for half an hour at the following. This piece of code:
reset() print 'Loop 1:' B=-2 for A in range(-3,-1): C=-A*B/(A+B) print "A:",A,"B:",B,"C:",C,"A*B+C*(A+B)=",A*B+C*(A+B) print 'Loop 2:' for A in range(-3,-1): for B in range(-3,-1): C=-A*B/(A+B) print "A:",A,"B:",B,"C:",C,"A*B+C*(A+B)=",A*B+C*(A+B) should in both loops (obviously) always assign that value to C such that A*B+C*(A+B) is 0. This indeed happens in the first loop, but not in the second. Here is the output (Kubuntu 11.04, Sage v. 4.6.2): Loop 1: A: -3 B: -2 C: 6/5 A*B+C*(A+B)= 0 A: -2 B: -2 C: 1 A*B+C*(A+B)= 0 Loop 2: A: -3 B: -3 C: 1 A*B+C*(A+B)= 3 A: -3 B: -2 C: 1 A*B+C*(A+B)= 1 A: -2 B: -3 C: 1 A*B+C*(A+B)= 1 A: -2 B: -2 C: 1 A*B+C*(A+B)= 0 What is happening here? I am sorry for obviously completely overlooking something trivial... Many thanks for your help, Kees -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org