Oh I see, I had forgotten about the format() command. Thank you! On Monday, November 12, 2018 at 12:20:14 PM UTC-5, kcrisman wrote: > > > I'm doing an assignment in Sage atm (through cocalc specifically), and one >> thing I am doing is taking the derivative of a function and plugging in x = >> 0 and showing that it is equal to 0. Since it is true, sage just outputs 0. >> I was hoping, however, that there was some way that sage would somehow show >> "d/dx( function) = 0" in one line in the output, so that I could make it >> more clear what exactly I was showing (reading the code can be a bit of an >> eyesore). Is there any automated way to do this? I was trying to use the >> show function but couldn't get it to work exactly how I wanted (I had to >> essentially type the function in tex form first, then use show() on that >> and then append on a show() for the output of the derivative). >> >> > Yup, pretty much! But it can be nicer than that, at least a little. > > @interact > def _(f=x^2,a=0): > f(x)=f > pretty_print(html("The derivative of ${}$ at $x={}$ is > ${}$".format(f(x),a,diff(f)(x=a)))) > > > https://sagecell.sagemath.org/?z=eJwljEEKwjAQRfeF3mEoWUwgiLgUAh7CdctgZmjA2jIOJSK9e1N9q8eH92_5Zaz0sLZJLDCgxNJfAsWzv7YNVASLj_L3RdnsMyxaKxxtemJ3HxkSa17J8sowC7jv5oAMXImH5fdv6U4y60SGx1-gkLIIiscSyVd291gpNQ==&lang=sage > > I imagine something similar would work on CoCalc Sage worksheets. >
-- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.