New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change specific heaviside() interface to Maxima #22850
Comments
comment:1
i am curious about the 2nd alternative: remove it altogether with a warning. does it mean that we can write a custom integrate method that fixes integration etc and symbolics? because if you compare with the similar problematic behaviour with the dirac delta:
then in this other case there is no other "dirac delta" that can be used as backup, in analogy to the unit step. hence in this case i have the impression that the 2nd alternative is the only choice, isn't it? |
comment:2
Replying to @mforets:
It would be if the result (the unevaluated integral) was mathematically wrong, but it's not, so it's not a bug. |
comment:3
However, another alternative for the enhancement of |
comment:4
is it possible to dispatch a particular integrator when the symbolic expression has the presence of a given function (such as dirac delta)? like a notion of "weak default" |
comment:5
Replying to @mforets:
Recognition works even in Python:
Changing the integrator would be done in |
comment:6
ok, and this would require some decorator technology? (just in case, in general i'm -1 to change the default integrator to other different than think that a similar trick could be applied to laplace with heaviside for instance |
comment:7
I have no idea (I only fiddled once with changing the result after the integrators had a go). Please go ahead. |
comment:8
we should also consider extending the available software interfaces to for the integral customization, there is some initial effort in the |
Commit: |
Branch: u/chapoton/22850 |
comment:9
tiny commit New commits:
|
Author: Frédéric Chapoton |
comment:10
here is a minimal fix, that apparently has no wrong side effect. Please review |
comment:11
Interestingly Sage does not define the Heaviside step function at
and now we have
From reading the wiki page, this can matter for some applications. This fixes how I think most people will use this (i.e., as a distribution as part of an integration problem), but there seems to be a bug in the conversion code that we should fix instead. I am comparing the following two:
In Interestingly enough, if I do With your proposed fix, I get an error:
Very roughly speaking, this is because Sage realizes that something is wrong with the round trip because it ends up in a difference place then where it started. Hence, I don't think we can use this approach. |
comment:12
Something very subtle is going on:
This "works" (the fact it cannot simplify the integral is quite bad on Maxima's part IMO, but that is a separate issue upstream) because it sets the correct conversion name. I am not sure if it is on our side, but this suggests that it is. |
comment:13
I don't quite understand the mechanism of how this works. I also don't know how to verify if this is a bug on Maxima's side or not. At this point I don't know how to fix this. (It really is baffling to me that maxima can handle the unit step function but not the Heaviside in the same way wrt integrals, but I digress.) |
comment:14
The solution would be to have, both in maxima and sage, one unique function (call it either unit_step or heaviside) Then we meet the other issue that there is no general agreement on what should be the value at 0. Some say 0, some say 1 and some say 1/2. On my branch, one gets
|
comment:15
Hmmm...probably having the functions |
Sage interfaces its Heaviside function with a Maxima function named
hstep
which seems to implement the same function. However, there is no documentation on it, and it is not supported in Runge-Kutta DE computations, nor in integration. This leads to mathematically wrong results when callingdesolve_rk4()
andintegrate()
with expressions containingheaviside
(but it's working withunit_step
).The ticket should either replace
hstep
withunit_step
in the Maxima interfaces, or remove it altogether with a warning. Alternatively, usesubstitute_function
indesolve_rk4()
andintegrate()
. Additionally, the issue withhstep
should be reported upstream.Upstream: Not yet reported upstream; Will do shortly.
CC: @tscrim @slel @kliem
Component: calculus
Author: Frédéric Chapoton
Branch/Commit: u/chapoton/22850 @
15df4b5
Issue created by migration from https://trac.sagemath.org/ticket/22850
The text was updated successfully, but these errors were encountered: