On Friday, April 8, 2011 2:51:03 PM UTC-7, ObsessiveMathsFreak wrote: > > That worked, thank you. But I don't understand why the standard > notation has so many problems. What exactly is going wrong? >
I think this is what's going on: if you start with this: > > def h(x,n): > > > if x>2: > > > return n-x > > > else: > > > return n*x-2 > and then do sage: plot(h(x, 3), (x, 0, 4)) (I assume this is what you mean by the "standard notation"), then *first* Sage tries to evaluate h(x,3). It can't tell that "x>2" is True, so it returns n*x-2, in this case 3*x-2. Then it plots that. In other words, it evaluates h symbolically as best it can: sage: h(x, 3) 3*x-2 Then it calls 'plot' on the result. -- John -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
