Opened 12 years ago
Closed 9 years ago
#1221 closed enhancement (fixed)
Consider using Mathematica syntax for integration
Reported by: | certik | Owned by: | mhansen |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | calculus | Keywords: | |
Cc: | jason | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
I think we should use this syntax for integration:
>>> integrate(x**3, (x, -1, 1)) 0 >>> integrate(sin(x), (x, 0, pi/2)) 1 >>> integrate(cos(x), (x, -pi/2, pi/2)) 2
instead of
sage: integral(x/(x^2+1), x, 0, 1) log(2)/2
as in SAGE currently, to be close to Mathematica. Because then you can use the syntax:
integrate(cos(x*y), (x, -pi/2, pi/2), (y, 0, pi))
for multiple integrals.
See also [1], how we discussed this in SymPy.
Change History (10)
comment:1 Changed 12 years ago by
- Milestone set to sage-2.9
comment:2 Changed 12 years ago by
Sage math appInbox Reply to all Forward Reply by chat Filter messages like this Print Add to Contacts list Delete this message Report phishing Report not phishing Show original Message text garbled? Why is this spam/nonspam? chris@seberino.org W. Stein I wanted to commend you for leading Sage. I think it is a great idea... Nov 19 (2 days ago) William Stein On Nov 20, 2007 11:10 AM, seberino@spawar.navy.mil So do I. I think we should... 11:17 AM (20 hours ago) Ondrej Certik to sage-devel show details 2:22 PM (17 hours ago) Reply On Nov 20, 2007 8:17 PM, William Stein <wstein@gmail.com> wrote: > > On Nov 20, 2007 11:10 AM, seberino@spawar.navy.mil > <seberino@spawar.navy.mil> wrote: > > > As to syntax, I think in Python we could use: > > > >>> integrate(cos(x), (x, -pi/2, pi/2)) > > > Because then you can > > > use the syntax: > > > > > > integrate(cos(x*y), (x, -pi/2, pi/2), (y, 0, pi)) > > > > > > for multiple integrals. But anyway, it's just a cosmetic issue. > > > > When I commended Sage's syntax I was assuming you were using this > > Mathematica like syntax already. I agree with Ondrej and think his > > suggestion above is the way to go. > > So do I. I think we should change that functions as suggested. Anybody > want to submit a patch? Ondrej, could you create a trac ticket making precise > what you want, etc.? http://sagetrac.org/sage_trac/ticket/1221 Ondrej - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~--- Reply Forward Stephen Forrest to sage-devel show details 2:44 PM (17 hours ago) Reply On Nov 20, 2007 2:10 PM, seberino@spawar.navy.mil <seberino@spawar.navy.mil> wrote: [snip] > > Because then you can > > use the syntax: > > > > integrate(cos(x*y), (x, -pi/2, pi/2), (y, 0, pi)) > > > > for multiple integrals. But anyway, it's just a cosmetic issue. > > When I commended Sage's syntax I was assuming you were using this > Mathematica like syntax already. I agree with Ondrej and think his > suggestion above is the way to go. This probably goes without saying, but presumably after the change one will still be able to use the syntax 'integrate(sin(x),x) ' for indefinite integration? That is, the second argument may be a triple or a symbol? Steve - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~--- Reply Forward Invite Stephen Forrest to chat Ondrej Certik to sage-devel show details 5:11 PM (14 hours ago) Reply On Nov 20, 2007 11:44 PM, Stephen Forrest <stephen.forrest@gmail.com> wrote: > > On Nov 20, 2007 2:10 PM, seberino@spawar.navy.mil > <seberino@spawar.navy.mil> wrote: > > [snip] > > > Because then you can > > > use the syntax: > > > > > > integrate(cos(x*y), (x, -pi/2, pi/2), (y, 0, pi)) > > > > > > for multiple integrals. But anyway, it's just a cosmetic issue. > > > > When I commended Sage's syntax I was assuming you were using this > > Mathematica like syntax already. I agree with Ondrej and think his > > suggestion above is the way to go. > > This probably goes without saying, but presumably after the change one > will still be able to use the syntax 'integrate(sin(x),x) ' for > indefinite integration? That is, the second argument may be a triple > or a symbol? Exactly as you say. Ondrej - Show quoted text -
comment:3 Changed 12 years ago by
- Component changed from algebraic geometry to calculus
- Owner changed from was to mhansen
- Status changed from new to assigned
comment:4 Changed 11 years ago by
- Summary changed from Use Mathematica syntax for integration to [won't fix] Use Mathematica syntax for integration
This will break backward compatibility in a massive way, so I would suggest setting it to "won't fix".
Cheers,
Michael
comment:5 Changed 11 years ago by
Well, I haven't replied here when you suggested won't fix, as I was thinking about this.
I understand that breaking code is bad.
But still consistency is consistency. There are ways to improve the API in a non compatible way, e.g. introduce both versions and raise python warning for the old API. and after couple releases, remove it.
Also this was agreed on the sage-devel, so if you seek a different conclusion, you should (imho) advocate that on the list.
comment:6 Changed 11 years ago by
See also #2787.
comment:7 Changed 11 years ago by
- Summary changed from [won't fix] Use Mathematica syntax for integration to Consider using Mathematica syntax for integration
comment:8 Changed 9 years ago by
- Cc jason added
- Report Upstream set to N/A
I suggest we close this ticket since we now support the suggested syntax:
---------------------------------------------------------------------- | Sage Version 4.4.1.alpha2-patched, Release Date: 2010-04-29 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- ********************************************************************** * * * Warning: this is a prerelease version, and it may be unstable. * * * ********************************************************************** sage: integrate(x**3, (x, -1, 1)) 0 sage: integrate(sin(x), (x, 0, pi/2)) 1 sage: integrate(cos(x), (x, -pi/2, pi/2)) 2
The docstring for sage.misc.functional.integrate()
and sage.symbolic.integration.integral.integral()
contains plenty of doctests to test the tuple syntax.
Further discussion on
- implementing multiple integrals with
integrate(cos(x*y), (x, -pi/2, pi/2), (y, 0, pi))
and - replacing the examples in the docstrings with the tuple syntax and deprecating the old one
can be continued in #2787.
Comments?
comment:9 Changed 9 years ago by
- Status changed from new to needs_info
I think so, the one-variable issue is resolved and the double integrals are covered in #2787
comment:10 Changed 9 years ago by
- Milestone changed from sage-4.6 to sage-duplicate/invalid/wontfix
- Resolution set to fixed
- Status changed from needs_info to closed
I'm closing this as fixed. See comment:8 for more info.
I changed this to sage-2.9, since it will be very easy to implement.