[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #56066] Symbolic integration of heaviside.
From: |
Colin Macdonald |
Subject: |
[Octave-bug-tracker] [bug #56066] Symbolic integration of heaviside. |
Date: |
Wed, 3 Apr 2019 13:26:13 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0 |
Follow-up Comment #1, bug #56066 (project octave):
I can confirm:
>> syms t
>> f = heaviside(t - 1)
f = (sym) Heaviside(t - 1)
>> F = int(f, t)
F = (sym)
⎧ 0 for │t│ < 1
⎪
⎨╭─╮0, 2 ⎛2, 1 │ ⎞
⎪│╶┐ ⎜ │ t⎟ otherwise
⎩╰─╯2, 2 ⎝ 1, 0 │ ⎠
that expression does seem to be technically correct for t >= -1:
>> double(subs(F, t, -1))
ans = 0
>> double(subs(F, t, sym(1)/2))
ans = 0
>> double(subs(F, t, 2))
ans = 1
>> double(subs(F, t, 3))
ans = 2
>> double(subs(F, t, 10))
ans = 9
But it seems to be wrong for t <= -1, where it should be zero.
There are various upstream SymPy bugs about heaviside and integrals:
Does this look like https://github.com/sympy/sympy/issues/12632?
A workaround is probably
>> g = rewrite(f, 'Piecewise')
g = (sym)
⎧ 0 for t - 1 < 0
⎪
⎨Heaviside(0) for t - 1 = 0
⎪
⎩ 1 for t - 1 > 0
>> int(g, t)
ans = (sym)
⎧ 0 for t < 1
⎨
⎩t - 1 otherwise
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?56066>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/