#6949: add symbolic max and min functions
-----------------------------+----------------------------------------------
   Reporter:  burcin         |       Owner:  burcin      
       Type:  enhancement    |      Status:  needs_review
   Priority:  major          |   Milestone:  sage-4.4.2  
  Component:  symbolics      |    Keywords:              
     Author:  Burcin Erocal  |    Upstream:  N/A         
   Reviewer:                 |      Merged:              
Work_issues:                 |  
-----------------------------+----------------------------------------------

Comment(by lfousse):

 Thanks for the updated patch. I applied it on top of 4.4. I can verify the
 previously reported problem for numerical evaluation works. I have however
 a new problem:
 {{{
 sage: f(x) = max_symbolic(sin(x), cos(x))
 sage: N(integral(f, x, 0, 1))
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /opt/sage-4.4/<ipython console> in <module>()

 /opt/sage-4.4/local/lib/python2.6/site-packages/sage/misc/functional.pyc
 in numerical_approx(x, prec, digits)
    1163             prec = int((digits+1) * 3.32192) + 1
    1164     try:
 -> 1165         return x.numerical_approx(prec)
    1166     except AttributeError:
    1167         from sage.rings.complex_double import
 is_ComplexDoubleElement

 /opt/sage-4.4/local/lib/python2.6/site-
 packages/sage/symbolic/expression.so in
 sage.symbolic.expression.Expression.n
 (sage/symbolic/expression.cpp:16928)()

 /opt/sage-4.4/local/lib/python2.6/site-
 packages/sage/symbolic/expression.so in
 sage.symbolic.expression.Expression._convert
 (sage/symbolic/expression.cpp:4677)()

 /opt/sage-4.4/local/lib/python2.6/site-packages/sage/functions/min_max.pyc
 in _evalf_(self, *args, **kwds)
     155             TypeError: cannot evaluate symbolic expression
 numerically
     156         """
 --> 157         return max_symbolic(args)
     158
     159 max_symbolic = MaxSymbolic()

 /opt/sage-4.4/local/lib/python2.6/site-packages/sage/functions/min_max.pyc
 in __call__(self, *args, **kwds)
      79                 return args
      80
 ---> 81         return BuiltinFunction.__call__(self, *args, **kwds)
      82
      83 class MaxSymbolic(MinMax_base):

 /opt/sage-4.4/local/lib/python2.6/site-packages/sage/symbolic/function.so
 in sage.symbolic.function.Function.__call__
 (sage/symbolic/function.cpp:4359)()

 /opt/sage-4.4/local/lib/python2.6/site-packages/sage/functions/min_max.pyc
 in _eval_(self, *args)
     136             ValueError: number of arguments must be > 0
     137         """
 --> 138         return self.eval_helper(max_symbolic, builtin_max, None,
 args)
     139
     140     def _evalf_(self, *args, **kwds):

 /opt/sage-4.4/local/lib/python2.6/site-packages/sage/functions/min_max.pyc
 in eval_helper(self, this_f, builtin_f, initial_val, args)
      51
      52         symb_args.append(res)
 ---> 53         return this_f(*symb_args)
      54
      55     def __call__(self, *args, **kwds):

 /opt/sage-4.4/local/lib/python2.6/site-packages/sage/functions/min_max.pyc
 in __call__(self, *args, **kwds)
      79                 return args
      80
 ---> 81         return BuiltinFunction.__call__(self, *args, **kwds)
      82
      83 class MaxSymbolic(MinMax_base):

 /opt/sage-4.4/local/lib/python2.6/site-packages/sage/symbolic/function.so
 in sage.symbolic.function.Function.__call__
 (sage/symbolic/function.cpp:4192)()

 TypeError: cannot coerce arguments: no canonical coercion from <type
 'NoneType'> to Symbolic Ring
 }}}
 I don't know if the problem is with integrate or max_symbolic.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6949#comment:7>
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