Re: [sage-support] Triple integrals in a specific region of space

129 views
Skip to first unread message
Message has been deleted

Dima Pasechnik

unread,
Sep 6, 2020, 4:09:53 AM9/6/20
to sage-support
[Technical warning]
Please do not post links with ads here (in particular the sort of ads
that basically obscure the important part - after I opened your link I
thought it's pure spam, for a moment). You can attach images to your
messages, or find a service that does not do this kind of spam, e.g.
github's gists can be used
(https://remarkablemark.org/blog/2016/06/16/how-to-add-image-to-gist/).

On Sun, Sep 6, 2020 at 8:25 AM Teodoro Coluccio
<teodoro....@gmail.com> wrote:
>
> Can I perform triple integrals in a region of space I define? I'm trying to migrate from mathematica to sage, and in mathematica I could go and define a region of space (with various limitations) and then perform the integral of a function on it. Here is an explanatory image:
> https://ibb.co/H74hgVS
> Is there a way to easily perform this operation even in sage?
>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/6692345e-f559-4637-9e4e-b679e9bbdc37n%40googlegroups.com.
Message has been deleted

Teodoro Coluccio

unread,
Sep 12, 2020, 7:23:56 AM9/12/20
to sage-support
Can I perform triple integrals in a region of space I define? I'm trying to migrate from mathematica to sage, and in mathematica I could go and define a region of space (with various limitations) and then perform the integral of a function on it. Here is an explanatory image:
screen.png

David Joyner

unread,
Sep 12, 2020, 8:05:17 AM9/12/20
to SAGE support
1) You have to integrate wrt z first, which I don't know whether Mma would understand without being told. 

sage: integral(integral(integral(x^2+2*y*z, (z, y, (2-x-2*y)/3)), (y, x, (2-x)/2)), (x, -1, 2))  

1681/320

2) Using sympy (in sage, but I used https://live.sympy.org/):

>>> var("x,y,z")
(x, y, z)(x, y, z)
>>> integrate(x*x+2*y*z, (z, y, (2-x-2*y)/3), (y, x, (2-x)/2), (x, -1, 2))
1681/320

3) You can also do this in maxima (also included in sage). See
for an example of how to use the syntax.

4) Instead of reposting the same question 3 times , it would be helpful to others with the same question just 
to keep the question in one thread.

5) Is this a homework problem for a math class?

 

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.

Dima Pasechnik

unread,
Sep 13, 2020, 6:30:09 AM9/13/20
to sage-support
On Sun, Sep 6, 2020 at 10:03 AM Teodoro Coluccio <teodoro....@gmail.com> wrote:
Can I perform triple integrals in a region of space I define? I'm trying to migrate from mathematica to sage, and in mathematica I could go and define a region of space (with various limitations) and then perform the integral of a function on it.

in general, there are no exact algorithms known for such a task. Mathematica does implement some heuristics, it's not clear which ones.
In your example you're integrating a polynomial over a polytope, for this case it's known how to do this exactly:
triangulate the region into simplices, then use an explicit formula for each simplex. Perhaps that's
what Mathematica doing, they don't tell us.
Not implemented in Sage, but it would be a nice addition.
 
Here is an explanatory image:
screen.png
Is there a way to easily perform this operation even in sage?

--

slelievre

unread,
Sep 13, 2020, 9:23:38 PM9/13/20
to sage-support


Le dimanche 13 septembre 2020 12:30:09 UTC+2, Dima Pasechnik a écrit :


On Sun, Sep 6, 2020 at 10:03 AM Teodoro Coluccio <teodoro...@gmail.com> wrote:
Can I perform triple integrals in a region of space I define? I'm trying to migrate from mathematica to sage, and in mathematica I could go and define a region of space (with various limitations) and then perform the integral of a function on it.

in general, there are no exact algorithms known for such a task. Mathematica does implement some heuristics, it's not clear which ones.
In your example you're integrating a polynomial over a polytope, for this case it's known how to do this exactly:
triangulate the region into simplices, then use an explicit formula for each simplex. Perhaps that's
what Mathematica doing, they don't tell us.
Not implemented in Sage, but it would be a nice addition.
 
Here is an explanatory image:
screen.png
Is there a way to easily perform this operation even in sage?



Note: also asked on Ask Sage:

- Triple integrals in a specific region of space

I posted an answer there.

Dima Pasechnik

unread,
Sep 15, 2020, 11:27:22 AM9/15/20
to sage-support
Thanks, right, I forgot the meaning of "int" in latte_int, sorry.
Indeed, this looks like one can actually do better than Mathematica, if latte_int is installed.


--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages