William Stein wrote: > On Tue, Sep 16, 2008 at 3:56 PM, Jason Grout > <[EMAIL PROTECTED]> wrote: >> I'm writing an @interact to solve simple 2nd order differential >> equations and plot solutions. In it, I'd like to typeset the formula: >> >> show(a*diff(y,t,2)+b*diff(y,t)+c==0) >> >> However, what shows up is the word "diff" when I'd really like to see >> math notation for a partial or total derivative (depending on the >> independent variables declared for y). Is there a nice way to get it to >> show up? >> >> Note that just printing a string doesn't work so well, since a, b, or c >> might be negative and then you get something like >> 3(d^2y/dt^2)+-2(dy/dt)+-3=0. >> >> For reference, the current (non/barely) working code is: >> >> var("x,t") >> @interact >> def _(y0=(0,4,1/5), y0p=(0,4,1/5),a=(-4,4,1/5),b=(-4,4,1/5),c=(-4,4,1/5)): >> y=function('y',t) >> show(a*diff(y,t,2)+b*diff(y,t)+c==0) > > Though ugly to input, I would be tempted to do something like this, > since the output looks superb: > > a = sin(x); y = cos(x^2) + e^(3*pi*x) > > html("$$%s \cdot \\frac{d^2}{dt^2}\\left[ %s \\right]$$"%(latex(a), latex(y)))
Thanks. Gee, it'd be nice if there was a %l for latex(object), just like there is currently a %r and %s which encapsulate calls to str(object) and repr(object) That might be changing the language too much, though. If it's a good idea, someone give it a +1. Thanks, Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---