# 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

## Post a Comment

Add a New Comment

You are not logged in

Please log in, so followups can be emailed to you.

## 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

## Mail Notification Carbon-Copy List

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

## Votes

Do you think this task is very important?
If so, you can add your encouragement to it.
This task has 0 encouragements so far.

Only project members can vote.

## History

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2019-04-03 mtmiller CategoryLibraries Octave Forge Package
StatusNone Confirmed
SummarySymbolic integration of heaviside. [octave forge] (symbolic) integration of heaviside
2019-04-03 zmarantz Attached File- Added Screen Shot 2019-04-03 at 12.50.18 PM.png, #46713

Powered by Savane 3.5