Opened 4 years ago

# Heaviside in numerical resolutions

Reported by: Owned by: mforets major sage-8.0 symbolics heaviside, integrate rws, kcrisman, egourgoulhon, tscrim N/A

• numerical ode:
```sage: y = var('y')
sage: desolve_rk4(x,y,ics=[0,0],end_points=1,step=0.5) # solution is x^2/2
[[0, 0], [0.5, 0.125], [1.0, 0.4999999999999999]]
sage: desolve_rk4(x*unit_step(1+x),y,ics=[0,0],end_points=1,step=0.5) # OK
[[0, 0], [0.5, 0.125], [1.0, 0.4999999999999999]]
sage: desolve_rk4(x*heaviside(1+x),y,ics=[0,0],end_points=1,step=0.5) # ??
[[0, 0]]
```
• integration:
```sage: integral(unit_step(x), (x, 0, 1))
1
sage: integral(heaviside(x), (x, 0, 1)) # ??
integrate(heaviside(x), x, 0, 1)
```
• custom numerical value at 0:
```sage: heaviside(0)
heaviside(0)
sage: f(x) = heaviside(x, 1/2); f(0)  # new 2nd argument (?)
1/2
```

### comment:1 Changed 4 years ago by mforets

• Description modified (diff)

### comment:2 Changed 4 years ago by tscrim

• Cc egourgoulhon tscrim added

### comment:3 Changed 4 years ago by rws

```sage: desolve_rk4(x*unit_step(1+x),y,ics=[0,0],end_points=1,step=0.5) # OK
[[0, 0], [0.5, 0.125], [1.0, 0.4999999999999999]]
sage: desolve_rk4(x*heaviside(1+x),y,ics=[0,0],end_points=1,step=0.5) # ??
[[0, 0]]
```

This is due to Maxima because with Maxima 5.38.1:

```(%i3) rk(x*unit_step(x+1),y,0,[x,0,1,0.500000000000000]);
(%o3)               [[0.0, 0.0], [0.5, 0.125], [1.0, 0.5]]
(%i4) rk(x*hstep(x+1),y,0,[x,0,1,0.500000000000000]);
(%o4)                            [[0.0, 0.0]]
```

### comment:4 Changed 4 years ago by rws

I cannot even find online documentation on `hstep`, nor a mention of the Heaviside function. I don't think we can rely on Maxima having implemented it, so we cannot provide DE or integral services with it.

### comment:5 Changed 4 years ago by rws

This is now #22850.

Note: See TracTickets for help on using tickets.