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

Consider using Mathematica syntax for integration #1221

Closed
certik opened this issue Nov 20, 2007 · 8 comments
Closed

Consider using Mathematica syntax for integration #1221

certik opened this issue Nov 20, 2007 · 8 comments

Comments

@certik
Copy link
Contributor

certik commented Nov 20, 2007

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.

[1] http://code.google.com/p/sympy/issues/detail?id=25

CC: @jasongrout

Component: calculus

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

@williamstein
Copy link
Contributor

comment:1

I changed this to sage-2.9, since it will be very easy to implement.

@williamstein williamstein added this to the sage-2.9 milestone Nov 21, 2007
@williamstein
Copy link
Contributor

comment:2
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 -

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Aug 10, 2008

comment:4

This will break backward compatibility in a massive way, so I would suggest setting it to "won't fix".

Cheers,

Michael

@sagetrac-mabshoff sagetrac-mabshoff mannequin changed the title Use Mathematica syntax for integration [won't fix] Use Mathematica syntax for integration Aug 10, 2008
@certik
Copy link
Contributor Author

certik commented Aug 31, 2008

comment:5

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.

@jicama
Copy link
Mannequin

jicama mannequin commented Aug 31, 2008

comment:6

See also #2787.

@sagetrac-mabshoff sagetrac-mabshoff mannequin changed the title [won't fix] Use Mathematica syntax for integration Consider using Mathematica syntax for integration Nov 14, 2008
@burcin
Copy link

burcin commented May 1, 2010

comment:8

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

Comments?

@robert-marik
Copy link
Mannequin

robert-marik mannequin commented Aug 24, 2010

comment:9

I think so, the one-variable issue is resolved and the double integrals are covered in #2787

@robert-marik robert-marik mannequin added the s: needs info label Aug 24, 2010
@burcin
Copy link

burcin commented Sep 8, 2010

comment:10

I'm closing this as fixed. See comment:8 for more info.

@burcin burcin closed this as completed Sep 8, 2010
@burcin burcin removed this from the sage-4.6 milestone Sep 8, 2010
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

4 participants