#13836: Fix variable dependence in PiecewisePolynomial
----------------------------------------------+-----------------------------
       Reporter:  christiankuper              |         Owner:  burcin       
           Type:  defect                      |        Status:  needs_work   
       Priority:  major                       |     Milestone:  sage-5.6     
      Component:  symbolics                   |    Resolution:               
       Keywords:  Piecewise, critical_points  |   Work issues:               
Report Upstream:  N/A                         |     Reviewers:  Burcin Erocal
        Authors:  Andrew Fleckenstein         |     Merged in:               
   Dependencies:                              |      Stopgaps:               
----------------------------------------------+-----------------------------
Description changed by afleckenstein:

Old description:

> When using the example in the documentation of the function the following
> results are displayed for critical points:
>
> {{{
> sage: R.<x> = QQ[]
> sage: f1 = x^0
> sage: f2 = 10*x - x^2
> sage: f3 = 3*x^4 - 156*x^3 + 3036*x^2 - 26208*x
> sage: f = Piecewise([[(0,3),f1],[(3,10),f2],[(10,20),f3]])
> sage: f.critical_points()
> [5.0, 12.000000000000124, 12.999999999999725, 14.000000000000151]
> }}}
>
> When doing the same with y instead of x as a variable an empty list is
> returned as a result:
>
> {{{
> sage: R.<y> = QQ[]
> sage: f1 = y^0
> sage: f2 = 10*y - y^2
> sage: f3 = 3*y^4 - 156*y^3 + 3036*y^2 - 26208*y
> sage: f = Piecewise([[(0,3),f1],[(3,10),f2],[(10,20),f3]])
> sage: f.critical_points()
> []
> }}}
>
> This behavior does not change even if y is explicitly defined as the
> variable:
>
> {{{
> sage: f = Piecewise([[(0,3),f1],[(3,10),f2],[(10,20),f3]],y)
> sage: f.critical_points()
> []
> }}}
>
> IMHO it should be possible to optain correct results no matter what the
> name of the variable is.

New description:

 When using the example in the documentation of the function the following
 results are displayed for critical points:

 {{{
 sage: R.<x> = QQ[]
 sage: f1 = x^0
 sage: f2 = 10*x - x^2
 sage: f3 = 3*x^4 - 156*x^3 + 3036*x^2 - 26208*x
 sage: f = Piecewise([[(0,3),f1],[(3,10),f2],[(10,20),f3]])
 sage: f.critical_points()
 [5.0, 12.000000000000124, 12.999999999999725, 14.000000000000151]
 }}}

 When doing the same with y instead of x as a variable an empty list is
 returned as a result:

 {{{
 sage: R.<y> = QQ[]
 sage: f1 = y^0
 sage: f2 = 10*y - y^2
 sage: f3 = 3*y^4 - 156*y^3 + 3036*y^2 - 26208*y
 sage: f = Piecewise([[(0,3),f1],[(3,10),f2],[(10,20),f3]])
 sage: f.critical_points()
 []
 }}}

 This behavior does not change even if y is explicitly defined as the
 variable:

 {{{
 sage: f = Piecewise([[(0,3),f1],[(3,10),f2],[(10,20),f3]],y)
 sage: f.critical_points()
 []
 }}}

 The wrong variable is also used (to varying effects) in the functions
 trapezoid() and derivative(). Multiple fourier series functions also use
 the wrong variable, but it doesn't affect the result. The Laplace
 transform also uses the wrong variable, but only if you aren't explicit
 about it.

 It should be possible to obtain correct results no matter what the name of
 the variable is.

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13836#comment:8>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to