different result with scipy integrate.tplquad
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 |
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 |
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
11.2k31337
11.2k31337
asked Oct 8 at 21:16
LetzerWille
3,4162918
3,4162918
@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
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 |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 |
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 |
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.8k795130
67.8k795130
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