I am trying to update some of the interacts from the MAA Prep workshop so
that they can be included in the UTMOST Sage cell repo. Here is an example
of what I came up with:
@interact
def _(f = input_box(default=sin(x)*e^(-x)),order=slider(1,20, step_size=1),
x0=("$x_0$", slider(0,4, step_size=0.25))):
p = plot(f,(x,-1,5), thickness=2)
ft = f.taylor(x, x0, order)
pt = plot(ft(x),(x,-1, 5), color='green', thickness=2)
dot = point((x0,f(x0)),pointsize=80,rgbcolor=(1,0,0))
pretty_print(html('$f(x)\;=\;%s$'%latex(f(x))))
pretty_print(html('$\hat{f}(x;%s)\;=\;%s+\mathcal{O}(x^{%s})$'%(x0,latex(ft(x)),order+1)))
show(dot + p + pt, ymin = -.5, ymax = 1)
On Friday, December 16, 2016 at 12:38:59 PM UTC-6, William Stein wrote:
>
> On Fri, Dec 16, 2016 at 10:29 AM, Thomas Judson <[email protected]
> <javascript:>> wrote:
> > The following statement prints “none” at the end of the output. I know
> that it is expecting an extra argument, but I can’t see what I am missing,
> >
> > pretty_print(html(r"$\displaystyle\frac{dx}{dt} = %s$" % latex(f)))
>
> You can do this as a workaround:
>
>
> html(r"$$\displaystyle\frac{dx}{dt} = %s$$" % latex(f))
>
> However, do youwant us to change things so pretty_print(None) outputs
> nothing, like sys.displayhook does? Alternatively, we could change
> things so html(...) returns the empty string "" instead of returning
> None. Thoughts? How are you really using this?
>
> William
>
> >
> > Tom
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "sage-cloud" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected] <javascript:>.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/DB37FBDB-2886-4995-A832-F2C7AF53D2D1%40gmail.com.
>
>
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
>
> Best Regards,
> William Stein
>
> CEO, SageMath, Inc.
>
--
You received this message because you are subscribed to the Google Groups
"sage-cloud" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sage-cloud/6c2c2f0d-33e3-484d-9b9b-0c8c05666f06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.