This is http://trac.sagemath.org/sage_trac/ticket/3717. Feeling motivated to fix it?
JM On Sep 16, 6: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) > show(" y(0)=%s, y'(0)=%s"%(y0,y0p)) > t0=0 > discriminant = sqrt(b^2-4*a*c) > if discriminant > 0: > r1 = (-b+discriminant)/(2*a) > r2 = (-b-discriminant)/(2*a) > c1=(y0p-y0*r1)/(r1-r2)*e^(-r1*t0) > c2=(y0*r1-y0p)/(r1-r2)*e^(-r2*t0) > soln = c1*e^(r1*t)+c2*e^(r2*t) > show(soln) > plot(soln,(t,0,5)).show() > > 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 -~----------~----~----~----~------~----~------~--~---