# bug #56066: [octave forge] (symbolic) integration of heaviside

 Submitted by: Z. M. Submitted on: Wed 03 Apr 2019 05:07:12 PM UTC Category: Octave Forge Package Severity: 3 - Normal Priority: 5 - Normal Item Group: None Status: Confirmed Assigned to: None Originator Name: zmarantz Open/Closed: Open Release: 4.4.0 Operating System: Mac OS

You are not logged in

## Discussion

Wed 03 Apr 2019 05:26:13 PM UTC, comment #1:

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

Colin Macdonald <cbm>
Wed 03 Apr 2019 05:07:12 PM UTC, original submission:

Hi Maintainer,

I am running Octave 4.4.0 on MAC OSX.

I'm working to integrate the heaviside function (as shown in the screenshot attached), but it doesn't appear to want to work when the argument is shifted.

Then again, maybe it is doing it correctly, but I do not understand what the output means.

Any assistance would be greatly appreciated.

Thank you,
Z.M.

Z. M. <zmarantz>

## Attached Files

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Comment:

Attached Files

## Dependencies

Depends on the following items: None found

Items that depend on this one: None found

Carbon-Copy List
• -email is unavailable- added by cbm (Posted a comment)
• -email is unavailable- added by zmarantz (Submitted the item)
•

Do you think this task is very important?
This task has 0 encouragements so far.

Only project members can vote.