#12123: Bug in convolution in old Piecewise
-----------------------------+------------------------
       Reporter:  kcrisman   |        Owner:  burcin
           Type:  defect     |       Status:  new
       Priority:  minor      |    Milestone:  sage-7.3
      Component:  calculus   |   Resolution:
       Keywords:  piecewise  |    Merged in:
        Authors:             |    Reviewers:
Report Upstream:  N/A        |  Work issues:
         Branch:             |       Commit:
   Dependencies:             |     Stopgaps:  todo
-----------------------------+------------------------
Changes (by mkoeppe):

 * cc: kcrisman, jondo, vbraun, slelievre, mkoeppe, eviatarbach, rws
 (added)
 * priority:  major => minor
 * milestone:  sage-6.4 => sage-7.3
 * keywords:   => piecewise


Old description:

> {{{
>
> sage: x = PolynomialRing(QQ,'x').gen()
> sage: f = Piecewise([[(-2, 2), 2 * x^0]])
> sage: g = Piecewise([[(0, 2), 3/4 * x^0]])
> sage: n = f.convolution(g)
>
> sage: n
> Piecewise defined function with 3 parts, [[(-2, 0), 3/2*x + 3], [(0, 2),
> 6], [(2, 4), -3/2*x + 6]]
> }}}
> But the middle piece should be 3, not 6, apparently.
>
> See the original report at [http://ask.sagemath.org/question/965
> /convolution-got-the-wrong-result this ask.sagemath.org question].

New description:

 The old Piecewise (pre #14801; now deprecated) has this bug:

 {{{

 sage: x = PolynomialRing(QQ,'x').gen()
 sage: f = Piecewise([[(-2, 2), 2 * x^0]])
 sage: g = Piecewise([[(0, 2), 3/4 * x^0]])
 sage: n = f.convolution(g)

 sage: n
 Piecewise defined function with 3 parts, [[(-2, 0), 3/2*x + 3], [(0, 2),
 6], [(2, 4), -3/2*x + 6]]
 }}}
 But the middle piece should be 3, not 6, apparently.

 See the original report at [http://ask.sagemath.org/question/965
 /convolution-got-the-wrong-result this ask.sagemath.org question].

 Note this is fixed in the new `piecewise` (lowercase p, from #14801).
 {{{
 sage: x = PolynomialRing(QQ,'x').gen()
 sage: f = piecewise([[(-2, 2), 2 * x^0]])
 sage: g = piecewise([[(0, 2), 3/4 * x^0]])
 sage: n = f.convolution(g)
 sage: n
 piecewise(x|-->3/2*x + 3 on (-2, 0], x|-->3 on (0, 2], x|-->-3/2*x + 6 on
 (2, 4]; x)
 }}}

 Can close this bug when the old `Piecewise` is removed completely.

--

Comment:

 Description modified to comment that this seems fixed in the new
 `piecewise` (#14801).

--
Ticket URL: <https://trac.sagemath.org/ticket/12123#comment:12>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to