[bug]Calculate a conditional re-integration
|
04-11-2019, 12:57 PM
Post: #1
|
|||
|
|||
[bug]Calculate a conditional re-integration
Not much to say, directly on the code
Code: ∫(∫(min(x^2,y^2),y,0,1),x,0,3) Code: Warning, integration of abs or sign assumes constant sign by intervals (correct if the argument is real): XCAS also gives the answer Code: 1 But it is the wrong answer WolframAlpha: ∫(∫(min(x^2,y^2),y,0,1),x,0,3) Wolfram Alpha is right Looking forward to the update of hp prime firmware in 2019 study hard, improve every day |
|||
04-11-2019, 06:30 PM
(This post was last modified: 04-11-2019 06:31 PM by parisse.)
Post: #2
|
|||
|
|||
RE: [bug]Calculate a conditional re-integration
You have been warned that some checks were not done, it's not that surprising that the answer is wrong. Now ask yourself, how can I solve this exacty in an algorithm? You must find an antiderivative of min(x^2,y^2), and to do that you must rewrite min(x^2,y^2) algebraically, which is
x^2+y^2-(x^2-y^2)*sign(x^2-y^2) then you can integrate w.r.t. y, since sign is constant by interval, g:=int((x^2+y^2)/2-abs(x^2-y^2)/2,y) giving (y^3/3+x^2*y)/2-sign(x^2-y^2)*(-y^3/3+x^2*y)/2 Then you would substitute between 0 and 1, h:=g(y=1)-g(y=0) but that's not sufficient, because you should take care of the points where sign(x^2-y^2) is not continuous and add the right/left limit difference. And that means solving an equation. I have decided not to solve it if it is a parametric equation (here the equation in y depends on x), because it would raise endless loops or fail, instead I issue a warning. Let's correct it : h1:=limit(g,y,x,1)-limit(g,y,x,-1) We must correct the integral by substracting this step, for x in [0,1], i.e substract int(h1,x,0,1)=1/6. I guess mathematica does more complete checks, but at some point, you will certainly be able to make it return wrong answer as well. I do not have a staff of people trying a lot of weird integrals to improve/implement automatic checks, you will have to be a little bit more smart, and fix answers when you have been warned. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)