# Ticket #10841: trac_10841_fix_piecewise_integrals_of_zero.patch

File trac_10841_fix_piecewise_integrals_of_zero.patch, 1.4 KB (added by D.S. McNeil, 12 years ago)
• ## sage/functions/piecewise.py

```# HG changeset patch
# User D. S. McNeil
# Date 1298536689 -28800
# Node ID d3bb8c30cfc0629c2416bf7b32282d8e8e39f96d
# Parent  8438b7c20d79c02a2ece3e1c3f7224a772ff8f07
Trac 10841: fix piecewise integrals involving zero

diff -r 8438b7c20d79 -r d3bb8c30cfc0 sage/functions/piecewise.py```
 a sage: f.integral() Piecewise defined function with 1 parts, [[(0, 5), x |--> sin(x)]] TESTS:: Verify that piecewise integrals of zero work (trac #10841):: sage: f0(x) = 0 sage: f = Piecewise([[(0,1),f0]]) sage: f.integral(x,0,1) 0 sage: f = Piecewise([[(0,1), 0]]) sage: f.integral(x,0,1) 0 sage: f = Piecewise([[(0,1), SR(0)]]) sage: f.integral(x,0,1) 0 """ if a != None and b != None: F = self.integral(x) forget(start < x) if definite or end != infinity: area += fun.integral(x, start, end) new_pieces.append([(start, end), fun_integrated.function(x)]) new_pieces.append([(start, end), SR(fun_integrated).function(x)]) if definite: return SR(area)