#19151: expression manipulations that do not preserve function latex_name and
print_latex_func
-------------------------------------------------+-------------------------
       Reporter:  bpage                          |        Owner:
           Type:  defect                         |       Status:  new
       Priority:  minor                          |    Milestone:  sage-6.9
      Component:  symbolics                      |   Resolution:
       Keywords:  expression manipulation,       |    Merged in:
  latex output, function                         |    Reviewers:
        Authors:                                 |  Work issues:
Report Upstream:  N/A                            |       Commit:
         Branch:                                 |     Stopgaps:
   Dependencies:                                 |
-------------------------------------------------+-------------------------
Description changed by rws:

Old description:

> See: https://cloud.sagemath.com/projects/b04b5777-e269-4c8f-
> a4b8-b21dbe1c93c6/files/print_latex_func.sagews
>
> --
>
> def argscript(self, *args): return
> "%s_{%s}"%(self.name(),','.join(map(repr, args)))
> f=function('f', print_latex_func=argscript)
> x,y=var('x,y')
> show(f(x,y))
> g=function('g', latex_name="\\mathcal{G}")
> show(g(x,y))
>
> # fail
> show(f(x,y).canonicalize_radical())
> show(g(x,y).canonicalize_radical())
> show(f(x,y).combine())
> show(g(x,y).combine())
> show(f(x,y).expand_log())
> show(g(x,y).expand_log())
> show(f(x,y).expand_sum())
> show(g(x,y).expand_sum())
> show(f(x,y).expand_trig())
> show(g(x,y).expand_trig())
> show(f(x,y).factor())
> show(g(x,y).factor())
> show(f(x,y).factorial_simplify())
> show(g(x,y).factorial_simplify())
> show(f(x,y).full_simplify())
> show(g(x,y).full_simplify())
> show(f(x,y).log_expand())
> show(g(x,y).log_expand())
> show(f(x,y).log_simplify())
> show(g(x,y).log_simplify())
> show(f(x,y).rational_simplify())
> show(g(x,y).rational_simplify())
> show(f(x,y).reduce_trig())
> show(g(x,y).reduce_trig())
> show(f(x,y).simplify())
> show(g(x,y).simplify())
> show(f(x,y).simplify_factorial())
> show(g(x,y).simplify_factorial())
> show(f(x,y).simplify_full())
> show(g(x,y).simplify_full())
> show(f(x,y).simplify_log())
> show(g(x,y).simplify_log())
> show(f(x,y).simplify_rational())
> show(g(x,y).simplify_rational())
> show(f(x,y).simplify_real())
> show(g(x,y).simplify_real())
> show(f(x,y).simplify_trig())
> show(g(x,y).simplify_trig())
> show(f(x,y).trig_expand())
> show(g(x,y).trig_expand())
> show(f(x,y).trig_reduce())
> show(g(x,y).trig_reduce())
> show(f(x,y).trig_simplify())
> show(g(x,y).trig_simplify())
>
> # works
> show(f(x,y).collect(x))
> show(g(x,y).collect(x))
> show(f(x,y).collect_common_factors())
> show(g(x,y).collect_common_factors())
> show(f(x,y).expand())
> show(g(x,y).expand())
> show(f(x,y).expand_rational())
> show(g(x,y).expand_rational())
> show(f(x,y).normalize())
> show(g(x,y).normalize())
> show(f(x,y).rational_expand())
> show(f(x,y).simplify_hypergeometric())
> show(g(x,y).simplify_hypergeometric())
> show(f(x,y).simplify_rectform())
> show(g(x,y).simplify_rectform())

New description:

 {{{
 def argscript(self, *args): return
 "%s_{%s}"%(self.name(),','.join(map(repr, args)))
 f=function('f', print_latex_func=argscript)
 x,y=var('x,y')
 show(f(x,y))
 g=function('g', latex_name="\\mathcal{G}")
 show(g(x,y))

 # fail
 show(f(x,y).canonicalize_radical())
 show(g(x,y).canonicalize_radical())
 show(f(x,y).combine())
 show(g(x,y).combine())
 show(f(x,y).expand_log())
 show(g(x,y).expand_log())
 show(f(x,y).expand_sum())
 show(g(x,y).expand_sum())
 show(f(x,y).expand_trig())
 show(g(x,y).expand_trig())
 show(f(x,y).factor())
 show(g(x,y).factor())
 show(f(x,y).factorial_simplify())
 show(g(x,y).factorial_simplify())
 show(f(x,y).full_simplify())
 show(g(x,y).full_simplify())
 show(f(x,y).log_expand())
 show(g(x,y).log_expand())
 show(f(x,y).log_simplify())
 show(g(x,y).log_simplify())
 show(f(x,y).rational_simplify())
 show(g(x,y).rational_simplify())
 show(f(x,y).reduce_trig())
 show(g(x,y).reduce_trig())
 show(f(x,y).simplify())
 show(g(x,y).simplify())
 show(f(x,y).simplify_factorial())
 show(g(x,y).simplify_factorial())
 show(f(x,y).simplify_full())
 show(g(x,y).simplify_full())
 show(f(x,y).simplify_log())
 show(g(x,y).simplify_log())
 show(f(x,y).simplify_rational())
 show(g(x,y).simplify_rational())
 show(f(x,y).simplify_real())
 show(g(x,y).simplify_real())
 show(f(x,y).simplify_trig())
 show(g(x,y).simplify_trig())
 show(f(x,y).trig_expand())
 show(g(x,y).trig_expand())
 show(f(x,y).trig_reduce())
 show(g(x,y).trig_reduce())
 show(f(x,y).trig_simplify())
 show(g(x,y).trig_simplify())

 # works
 show(f(x,y).collect(x))
 show(g(x,y).collect(x))
 show(f(x,y).collect_common_factors())
 show(g(x,y).collect_common_factors())
 show(f(x,y).expand())
 show(g(x,y).expand())
 show(f(x,y).expand_rational())
 show(g(x,y).expand_rational())
 show(f(x,y).normalize())
 show(g(x,y).normalize())
 show(f(x,y).rational_expand())
 show(f(x,y).simplify_hypergeometric())
 show(g(x,y).simplify_hypergeometric())
 show(f(x,y).simplify_rectform())
 show(g(x,y).simplify_rectform())
 }}}

  * See: https://cloud.sagemath.com/projects/b04b5777-e269-4c8f-
 a4b8-b21dbe1c93c6/files/print_latex_func.sagews
  * https://groups.google.com/forum/?hl=en#!topic/sage-devel/owdIv8nxZSU

--

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