Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full symbolic sum function #21645

Closed
rwst opened this issue Oct 5, 2016 · 15 comments
Closed

Full symbolic sum function #21645

rwst opened this issue Oct 5, 2016 · 15 comments

Comments

@rwst
Copy link

rwst commented Oct 5, 2016

sum(ex,...) always gets sent to calculus.symbolic_sum() where Maxima is called. If unevaluated an anonymous function sum is returned.

sage: ex=sum(gamma(n), n,1,a)
sage: ex.operator()
sum
sage: type(_)
<class 'sage.symbolic.function_factory.NewSymbolicFunction'>

This is unsatisfactory in many regards. Calls always go through Maxima, even if one wants just a sum expression held unevaluated. Also the anonymous function cannot be evaluated or substituted. For these reasons making a full symbolic sum function is a natural decision.

See also #17505

Component: symbolics

Author: Ralf Stephan

Branch/Commit: 7e8d0d0

Reviewer: Nils Bruin

Issue created by migration from https://trac.sagemath.org/ticket/21645

@rwst rwst added this to the sage-7.4 milestone Oct 5, 2016
@sagetrac-tmonteil
Copy link
Mannequin

sagetrac-tmonteil mannequin commented Oct 7, 2016

comment:1

Indeed ! This issue is known for a while, see this ask question for a dirty workaround. Funnily, i recently got a similar request privately, and was about to open a ticket to add a hold parameter to symbolic sum, i guess this ticket will take care of that too.

@rwst

This comment has been minimized.

@rwst
Copy link
Author

rwst commented Nov 10, 2016

Branch: u/rws/full_symbolic_sum_function

@rwst
Copy link
Author

rwst commented Nov 10, 2016

New commits:

65d3d4421645: full symbolic sum function

@rwst
Copy link
Author

rwst commented Nov 10, 2016

Author: Ralf Stephan

@rwst
Copy link
Author

rwst commented Nov 10, 2016

Commit: 65d3d44

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 10, 2016

Changed commit from 65d3d44 to 29f7d1b

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 10, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

29f7d1b21645: remove forgotten diagnostic

@nbruin
Copy link
Contributor

nbruin commented Nov 10, 2016

comment:6

Looking at the patch, I see presently special work happens on maxima's return values, which replaces maxima's "inert" sum with sage's newly grown symbolic sum function. I think that's problematic (for instance, we could have nested sums, and the nested sums would escape this treatment). Also, the test used (isinstance(op,SymbolicFunction)) is a little suspicious: I think it would get the result from

sum(f(x),n,0,0)

wrong.

It should be possible to use the standard SR-to-maxima and maxima-to-SR translation dictionaries for this, just as functions like sin etc. get properly translated. Isn't the line

+        BuiltinFunction.__init__(self, "sum", nargs=4,
+                               conversions=dict(maxima='sum'))

already enough to get the required automatic translations? If not, perhaps there is a manual override somewhere else that needs to be removed to let the normal translation take its course?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 11, 2016

Changed commit from 29f7d1b to 7e8d0d0

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 11, 2016

Branch pushed to git repo; I updated commit sha1. New commits:

7e8d0d021645: remove unnecessary code

@rwst
Copy link
Author

rwst commented Nov 11, 2016

comment:8

You're right!

@nbruin
Copy link
Contributor

nbruin commented Nov 12, 2016

Reviewer: Nils Bruin

@nbruin
Copy link
Contributor

nbruin commented Nov 12, 2016

comment:9

Looks good and patchbot is happy (coverage plugin failure seems to be on code that this actual branch doesn't touch)

@vbraun
Copy link
Member

vbraun commented Nov 15, 2016

Changed branch from u/rws/full_symbolic_sum_function to 7e8d0d0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants