different result with scipy integrate.tplquad
up vote
1
down vote
favorite
With Matematica this integral gives me 3. wolfram alpha
With integrate.tplquad I get -3.
This is Matematica code.
Integrate[1-x, (0,2),(0,3-1.5*x),(0,6-3*x -2*y)]
I can't see what I am doing wrong with ntegrate.tplquad
f = lambda x,y,z: 1-x
x1, x2 = 0,2
y1, y2 = lambda x : 0 , lambda x:3-1.5*x
z1, z2 = lambda x,y:0, lambda x,y: 6 -3*x -2*y
print(integrate.tplquad(f,x1,x2, y1, y2, z1, z2)[0])
-3.0
python scipy wolfram-mathematica
add a comment |
up vote
1
down vote
favorite
With Matematica this integral gives me 3. wolfram alpha
With integrate.tplquad I get -3.
This is Matematica code.
Integrate[1-x, (0,2),(0,3-1.5*x),(0,6-3*x -2*y)]
I can't see what I am doing wrong with ntegrate.tplquad
f = lambda x,y,z: 1-x
x1, x2 = 0,2
y1, y2 = lambda x : 0 , lambda x:3-1.5*x
z1, z2 = lambda x,y:0, lambda x,y: 6 -3*x -2*y
print(integrate.tplquad(f,x1,x2, y1, y2, z1, z2)[0])
-3.0
python scipy wolfram-mathematica
@kabanus, I will update with the code. But there is is link to wolfram on the first line.
– LetzerWille
Oct 8 at 21:29
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
With Matematica this integral gives me 3. wolfram alpha
With integrate.tplquad I get -3.
This is Matematica code.
Integrate[1-x, (0,2),(0,3-1.5*x),(0,6-3*x -2*y)]
I can't see what I am doing wrong with ntegrate.tplquad
f = lambda x,y,z: 1-x
x1, x2 = 0,2
y1, y2 = lambda x : 0 , lambda x:3-1.5*x
z1, z2 = lambda x,y:0, lambda x,y: 6 -3*x -2*y
print(integrate.tplquad(f,x1,x2, y1, y2, z1, z2)[0])
-3.0
python scipy wolfram-mathematica
With Matematica this integral gives me 3. wolfram alpha
With integrate.tplquad I get -3.
This is Matematica code.
Integrate[1-x, (0,2),(0,3-1.5*x),(0,6-3*x -2*y)]
I can't see what I am doing wrong with ntegrate.tplquad
f = lambda x,y,z: 1-x
x1, x2 = 0,2
y1, y2 = lambda x : 0 , lambda x:3-1.5*x
z1, z2 = lambda x,y:0, lambda x,y: 6 -3*x -2*y
print(integrate.tplquad(f,x1,x2, y1, y2, z1, z2)[0])
-3.0
python scipy wolfram-mathematica
python scipy wolfram-mathematica
edited Oct 8 at 21:34
kabanus
10.9k21237
10.9k21237
asked Oct 8 at 21:16
LetzerWille
3,4032918
3,4032918
@kabanus, I will update with the code. But there is is link to wolfram on the first line.
– LetzerWille
Oct 8 at 21:29
add a comment |
@kabanus, I will update with the code. But there is is link to wolfram on the first line.
– LetzerWille
Oct 8 at 21:29
@kabanus, I will update with the code. But there is is link to wolfram on the first line.
– LetzerWille
Oct 8 at 21:29
@kabanus, I will update with the code. But there is is link to wolfram on the first line.
– LetzerWille
Oct 8 at 21:29
add a comment |
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
Double-check the tplquad
docstring; you'll see that the signature of the function f
is f(z, y, x)
. So it looks like your integrand should be:
f = lambda x, y, z: 1 - z
1
I actually thought it more natural to change the signature rather than the function. Weird how these things are.
– kabanus
Oct 8 at 21:34
This one is really counter intuitive. Thank you.
– LetzerWille
Oct 8 at 21:49
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
Double-check the tplquad
docstring; you'll see that the signature of the function f
is f(z, y, x)
. So it looks like your integrand should be:
f = lambda x, y, z: 1 - z
1
I actually thought it more natural to change the signature rather than the function. Weird how these things are.
– kabanus
Oct 8 at 21:34
This one is really counter intuitive. Thank you.
– LetzerWille
Oct 8 at 21:49
add a comment |
up vote
3
down vote
accepted
Double-check the tplquad
docstring; you'll see that the signature of the function f
is f(z, y, x)
. So it looks like your integrand should be:
f = lambda x, y, z: 1 - z
1
I actually thought it more natural to change the signature rather than the function. Weird how these things are.
– kabanus
Oct 8 at 21:34
This one is really counter intuitive. Thank you.
– LetzerWille
Oct 8 at 21:49
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
Double-check the tplquad
docstring; you'll see that the signature of the function f
is f(z, y, x)
. So it looks like your integrand should be:
f = lambda x, y, z: 1 - z
Double-check the tplquad
docstring; you'll see that the signature of the function f
is f(z, y, x)
. So it looks like your integrand should be:
f = lambda x, y, z: 1 - z
answered Oct 8 at 21:30
Warren Weckesser
67.3k794129
67.3k794129
1
I actually thought it more natural to change the signature rather than the function. Weird how these things are.
– kabanus
Oct 8 at 21:34
This one is really counter intuitive. Thank you.
– LetzerWille
Oct 8 at 21:49
add a comment |
1
I actually thought it more natural to change the signature rather than the function. Weird how these things are.
– kabanus
Oct 8 at 21:34
This one is really counter intuitive. Thank you.
– LetzerWille
Oct 8 at 21:49
1
1
I actually thought it more natural to change the signature rather than the function. Weird how these things are.
– kabanus
Oct 8 at 21:34
I actually thought it more natural to change the signature rather than the function. Weird how these things are.
– kabanus
Oct 8 at 21:34
This one is really counter intuitive. Thank you.
– LetzerWille
Oct 8 at 21:49
This one is really counter intuitive. Thank you.
– LetzerWille
Oct 8 at 21:49
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52710223%2fdifferent-result-with-scipy-integrate-tplquad%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
@kabanus, I will update with the code. But there is is link to wolfram on the first line.
– LetzerWille
Oct 8 at 21:29