Use Piecewise. Type Piecewise? For examples.
On Tuesday, March 16, 2010, Jose Guzman <n...@neurohost.org> wrote: > Hi everybody, > > i was wondering, which is the best method to plot a conditional function > within an interval. For example, a function whose values are: > > 0 if t<t0 > f(t) if t>t0 > > where f(t) is a simple monoexponential decay that starts at t0. I tried the > following in Sage: > > t = var('t') > > def f(t,t0): > if t<t0: > return 0 > else: > return e**(-(t)/tau) > > Now if I plot > > plot(f(t,t0=0.5,tau=0.05,0,1,rgbcolor='red') > > The plot starts at t=0 and unfortunately the function f(t) too! > > Is there any better way to define a conditional function with Sage? > > Thanks a lot in advance. > > Jose. > > -- > 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 > -- 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