-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
make heaviside and step play nicely together. #10070
Comments
comment:1
See also #10071 for how this would allow |
comment:7
the problem is that in many contexts (that is, university courses and books), the heaviside step function is not assigned the value 1/2 at 0, as was the choice in let me mention in passing that a proper class of distributions with some flesh in it would be a (cool!) feature. compare to:
in sum, this is to suggest:
|
comment:8
From the wikipedia page, it is mostly a convention choice and depends on the situation. The current behavior actually doesn't allow it to be evaluated at 0:
There seem to be some other differences with step:
So both of these approaches might need some work. |
comment:9
i think this ticket should also fix integration with the default interface (Maxima):
|
comment:11
Replying to @tscrim:
ok. i think that it should rather break with:
intereseting, i didn't yet understand how to "add new functions to the SFunction table", hints welcome. for instance, |
comment:12
Ralf, can you help us with the SFunction table (comment:11)? I haven't ever used it either. I would also appreciate any thoughts you had about the Heaviside step function. On a sight tangent, I've been told it is somewhat slow for use in SageManifolds and if there was a way to make it faster (I can cc Eric too for more details). |
comment:13
I opened an issue: pynac/pynac#243 |
comment:14
Replying to @tscrim:
the module piecewise.py is using heaviside is just |
comment:15
Replying to @tscrim:
Ok I have now looked a bit into this. The SFunctionTable problem comes from the fact that there is no step function class in
Creation is not really slow but numerics is:
The ZZ and QQ numbers can be easily and well improved by changing So, is a |
comment:16
Replying to @rwst:
thanks! so i tried BuiltinFunction -> GinacFunction in the def of FunctionHeaviside (and at the then i defined a new |
comment:17
I bet the slow part of
which has a Python (i.e., not Cython)
This one is hard because they all have slightly different behaviors with dealing with |
comment:18
Replying to @mforets:
Probably because you still had "heaviside" as name argument in the
But then nothing is done in C++ so no speedup. |
comment:19
Note that if you allow a separate |
comment:20
i'd like to argue in favor of 1 for some people, the fact that heaviside is undefined at 0 is good and expected, because what it really defines is an equivalence class, and it is typically used in the context of distributions. in concrete, linear systems theory (to model a on/off switch) and for differential -> algebraic transformations in physics problems (applications of laplace transform). but for other set of users (as in the OP description), this may be confusing, and in many contexts one wouldn't like to talk about equivalence class and the if i had to change something it would be the derivative operator of (*) argument: it's not possible to make a plot, (note: ..this comment could be more illustrative of different uses (or not) with proper references to books/courses but i don't have time to go into that now :/ ) |
comment:21
Replying to @mforets:
So the Pynac's |
comment:29
I will try to include the relevant changes in the next Pynac version 0.7.6. |
comment:30
Replying to @mforets:
One (EDITED) |
comment:31
I don't know if this pertains to this ticket but, aside from the value at 0, another difference between
The value at 0 cannot explain such difference because |
comment:32
Note that
results in an error, but that should be fixed by the proposed change. |
Changed branch from u/mforets/make_heaviside_and_step_play_nicely_together_ to u/rws/10070-1 |
Dependencies: #22838 |
Author: Ralf Stephan |
comment:35
@rwst : cool, i was able to test it! (thanks to your answer in the other ticket). Wow! so heaviside is really defined in we still have issues that have been raised in this thread that should be fixed (optional definition at 0, use in |
comment:36
Replying to @mforets:
Agreed. |
comment:37
There was a part of me that hoped this would fix comment:31 (it does fix comment:32 as I predicted), but it doesn't. However, I agree that this should be a separate ticket. I think we need to also update the documentation for |
Changed branch from u/rws/10070-1 to u/mforets/10070 |
comment:38
update docstring of New commits:
|
comment:39
Replying to @tscrim:
separate ticket: #22849, Heaviside in numerical resolutions. |
Reviewer: Travis Scrimshaw |
comment:40
Your last commit will likely conflict with a similar change I made on #22838. Once you merge in those changes, you can set a positive review on my behalf (and add your name to the reviewers list). |
comment:42
@tscrim : merge done, thanks! |
Changed reviewer from Travis Scrimshaw to Travis Scrimshaw, Marcelo Forets |
Changed branch from u/mforets/10070 to |
The heaviside built-in function and the step symbolic method are not the same at zero.
And the documentation seems to indicate that
heaviside
should be undefined (?) at zero, though it's not definitive.In addition to reconciling these, we should probably unify notation or something.
Depends on #22838
CC: @mforets @rwst
Component: symbolics
Author: Ralf Stephan
Branch/Commit:
bbc921e
Reviewer: Travis Scrimshaw, Marcelo Forets
Issue created by migration from https://trac.sagemath.org/ticket/10070
The text was updated successfully, but these errors were encountered: