Oliver Block wrote:
> Dear Stefanie,
> 
> On Mon, Feb 23, 2009 at 11:55:27AM +0100, Stefanie Schmidt wrote:
> [...]
>> G=plot(h(f), 0, 20)
>> G.show()
> Although I am not a sage expert, I would say, you want the
> following:
> 
> G=plot(h, 0, 20)
> G.show()
> 
> Do not give an argument to h.


Yes, that is correct.  When someone calls plot(h(f), 0, 20), then h is 
evaluated at  f first, so if f was 10, then plot(h(f), 0, 20) is exactly 
the same as plot(0, 0, 20).  In order to call h with the numeric values 
between 0 and 20, you need to pass the *function* h, not the output of 
evaluating the function at f.

Things would work differently if h was a symbolic expression, rather 
than a python function.  For example:

h(x) = sin(x)

plot(h(x), (x, 0, 20))

or

plot(h, 0, 20)

would both give the expected plot, because h(x) is sin(x) (i.e., a 
function, not a number), and h is the function x |--> sin(x).

Jason


--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to