On Sun, Jul 28, 2013 at 11:23 AM, Stefan Krastanov <[email protected]> wrote: > Below I try to answer the question (basically there is no way for the > moment), but could you tell us how you actually expected this figure to look > like? > > There does not seem to be a satisfactory way to do it. After all DiracDelta > is zero at all points besides x=0, so simple sampling will miss this point. > If x=0 is actually sampled, it returns infinity which either will cause the > code to crash or it will mask the point as a NaN so it will be invisible. > > A step forward to solving this would be to have some kind of asymptote > detector that changes the scale of the plot accordingly. > > Another way to solve this would be to provide an appropriate api for > functions to tell the plotting module that they have such degenerate points.
This would be the ideal solution, so that we could print some kind of vertical line, like at http://en.wikipedia.org/wiki/Dirac_delta. It would also allow plotting things like 1/x with dashed lines at that asymptote, and even non-vertical asymptotes. I like the idea of the API, so that we could have this be both automatic based on solve() and extensible. This would be useful outside of plotting as well. For now, probably the easiest way to do this would be to find some suitable fn(x) such that fn(x) -> DiracDelta(x) as n -> oo and plot fn(x) for n pretty large. Stefan will have to comment on what kind of fn will be best suited for the plotting module. Aaron Meurer > > In any case, a lot of work is necessary for the implementation of a > satisfactory solution. > > > On 28 July 2013 18:00, <[email protected]> wrote: >> >> Here is my python notebook script >> >> while the last plot the ipython kernel seems to be busy all the time >> >> ============== >> import sympy >> from sympy.plotting import plot >> from sympy.abc import t,tau >> >> u_t = 2 * DiracDelta(t) >> g_t = 0.5 * ( Heaviside(t)-Heaviside(t-2) ) >> >> plot(g_t, (t, -5, 5)) >> ============== >> >> plot( integrate( u_t.subs(t,tau)*g_t.subs(t,t-tau), (tau,-10, 10)), >> (t,-10,10)) >> plot( integrate( u_t.subs(t,tau)*u_t.subs(t,t-tau), (tau,-10, 10)), >> (t,-10,10)) >> plot( integrate( g_t.subs(t,tau)*g_t.subs(t,t-tau), (tau,-10, 10)), >> (t,-10,10)) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sympy" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/sympy. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
