This notation isn't very flexible though. For example, suppose I
wanted to plot h(-x,n) over the same range.

Can this be done without calling the symbolic engine? Is there a way
to bypass symbolic plots altogether?

On Apr 8, 11:25 pm, John H Palmieri <jhpalmier...@gmail.com> wrote:
> 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 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

Reply via email to