Opened 7 years ago
Closed 6 years ago
#16459 closed defect (fixed)
document use of lambda for nonsymbolic functions
Reported by:  rws  Owned by:  

Priority:  major  Milestone:  sage6.4 
Component:  documentation  Keywords:  
Cc:  Merged in:  
Authors:  Ralf Stephan  Reviewers:  KarlDieter Crisman 
Report Upstream:  N/A  Work issues:  
Branch:  1172f62 (Commits)  Commit:  1172f6253c3a4cd6b9d80b91657ef00a006b8f4c 
Dependencies:  Stopgaps: 
Description (last modified by )
Previous title "polar_plot crash with expressions containing nonsymbolic functions".
Reported on sagesupport:
sage: polar_plot((1+cos(fibonacci(floor(alpha)))), (alpha, 3*pi/2,pi/2))  TypeError Traceback (most recent call last) <ipythoninput5d55fb7d2b898> in <module>() > 1 polar_plot((Integer(1)+cos(fibonacci(floor(alpha)))), (alpha, Integer(3)*pi/Integer(2),pi/Integer(2))) /home/ralf/sage/local/lib/python2.7/sitepackages/sage/combinat/combinat.pyc in fibonacci(n, algorithm) 500 TypeError: no conversion of this rational to integer 501 """ > 502 n = ZZ(n) 503 if algorithm == 'pari': 504 return ZZ(pari(n).fibonacci()) /home/ralf/sage/local/lib/python2.7/sitepackages/sage/structure/parent.so in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:8905)() /home/ralf/sage/local/lib/python2.7/sitepackages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.NamedConvertMap._call_ (sage/structure/coerce_maps.c:5442)() /home/ralf/sage/local/lib/python2.7/sitepackages/sage/symbolic/expression.so in sage.symbolic.expression.Expression._integer_ (sage/symbolic/expression.cpp:6142)() TypeError: unable to convert x (=floor(alpha)) to an integer
Change History (13)
comment:1 Changed 7 years ago by
 Summary changed from polar_plot crash with expressions containing floor to polar_plot crash with expressions containing fibonacci
comment:2 Changed 7 years ago by
 Summary changed from polar_plot crash with expressions containing fibonacci to polar_plot crash with expressions containing floor
comment:3 Changed 7 years ago by
 Summary changed from polar_plot crash with expressions containing floor to polar_plot crash with expressions containing nonsymbolic functions
comment:4 Changed 7 years ago by
comment:5 Changed 7 years ago by
Could be worth adding examples of how to use lambda functions for precisely this contingency in several place in the docs. Though see #8383 for some actual use cases (and how do other systems handle this?) suggesting to make symbolic versions of everything.
comment:6 Changed 7 years ago by
 Milestone changed from sage6.3 to sageduplicate/invalid/wontfix
 Status changed from new to needs_review
Thanks. I think it best to move the discussion to #8383 where some arguments have been weighed already.
comment:7 Changed 7 years ago by
 Milestone changed from sageduplicate/invalid/wontfix to sage6.3
Sorry, I must not have made it clear that if we aren't going to fix the symbolic equivalents thing (which seems reasonable) then we should document how to do this with lambdas for someone who might want to do this plot (for instance) nonetheless.
comment:8 Changed 7 years ago by
 Component changed from symbolics to documentation
 Description modified (diff)
 Status changed from needs_review to needs_work
 Summary changed from polar_plot crash with expressions containing nonsymbolic functions to document use of lambda for nonsymbolic functions
comment:9 Changed 7 years ago by
 Branch set to u/rws/document_use_of_lambda_for_non_symbolic_functions
comment:10 Changed 7 years ago by
 Commit set to 1172f6253c3a4cd6b9d80b91657ef00a006b8f4c
 Status changed from needs_work to needs_review
I have added a note to the plot documentation. Where else do you think it's needed?
New commits:
1172f62  16459: add note in documentation

comment:11 Changed 6 years ago by
 Milestone changed from sage6.3 to sage6.4
comment:12 Changed 6 years ago by
 Reviewers set to KarlDieter Crisman
 Status changed from needs_review to positive_review
This is terse, but I think is a good start on this. Merges and looks nice in output.
comment:13 Changed 6 years ago by
 Branch changed from u/rws/document_use_of_lambda_for_non_symbolic_functions to 1172f6253c3a4cd6b9d80b91657ef00a006b8f4c
 Resolution set to fixed
 Status changed from positive_review to closed
Close as won't fix?
polar_plot
never gets its argument, sincefibonacci
isn't symbolic:Apart from hobbling sage by equipping every conceivable function in sage with a symbolic equivalent, we can't really do something about this (perhaps document somewhere where newbies will look?)