Message Boards Message Boards

Solve with Integrate wouldn't produce correct answers

Posted 1 month ago
POSTED BY: Zhenyu Zeng
7 Replies

Possibly, though currently the problem can easily be solved. You just need to separate the integral computation from the algebraic equation solving. The integral computation does take about 20 minutes.

f = Sqrt[1 - x^2 - y^2] + c;  

eqn = (c == -8/Pi*Integrate[f, {x, 0, 1/2}, 
   {y, -Sqrt[1/4 - x^2] + 1/2, Sqrt[1/4 - x^2] + 1/2}]);    

In[16]:= Solve[eqn, c]//FullSimplify//InputForm                                 

Out[16]//InputForm= 
{{c -> (32 - 24*Pi + 6*(-1)^(1/6)*Log[2 + (-1)^(1/6)*Sqrt[2]] + 
     3*Sqrt[3]*Log[5 - 2*Sqrt[6]] + 
     (3*I)*Log[(3 - Sqrt[6] + Root[36 + 60*#1^2 + #1^4 & , 3, 0])/3] - 
     3*Sqrt[3]*Log[Root[3 - 12*#1 + 34*#1^2 - 12*#1^3 + 3*#1^4 & , 2, 0]] + 
     3*((-I)*Pi + Log[-2 + (-1)^(1/6)*Sqrt[2]])*Root[16 - 4*#1^2 + #1^4 & , 1, 
       0])/(36*Pi)}}
POSTED BY: Adam Strzebonski

And here's the simple answer, that you probably expect your students to find...

In[21]:= Solve[eqn, c]//TrigToExp//FullSimplify//InputForm                      

Out[21]//InputForm= {{c -> -2/3 + 8/(9*Pi)}}
POSTED BY: Adam Strzebonski
Posted 1 month ago

What computer configuration are you using? I've been calculating for 2 hours but still no results.

POSTED BY: Updating Name

Solve considers the expressions declared as variables to be atomic objects. Effectively they are first replaced with new symbols and then solved for:

In[1]:= f[x, y] ==                                                              
    Sqrt[1 - x^2 - y^2] -                                                       
      8/Pi*Integrate[                                                           
         f[x, y], {x, 0, 1/2}, {y, -Sqrt[1/4 - x^2] + 1/2,                      
           Sqrt[1/4 - x^2] + 1/2}] /. f[x, y]->z // InputForm                   

Out[1]//InputForm= z == Sqrt[1 - x^2 - y^2] - z

In[2]:= Solve[%, z]//InputForm                                                  

Out[2]//InputForm= {{z -> Sqrt[1 - x^2 - y^2]/2}}

This is similar to

In[3]:= Solve[x==Sin[x], Sin[x]]

Out[3]= {{Sin[x] -> x}}

If you specify {x, y} as the variables then f[x, y] is treated as a function of the variables and Solve knows that it cannot solve the equation.

In[4]:= Solve[f[x, y] ==
   Sqrt[1 - x^2 - y^2] -
    8/Pi*Integrate[
      f[x, y], {x, 0, 1/2}, {y, -Sqrt[1/4 - x^2] + 1/2,
       Sqrt[1/4 - x^2] + 1/2}], {x, y}]//Head

Solve::nsmet: This system cannot be solved with the methods available to Solve.
    Try Reduce or FindInstance instead.

Out[4]= Solve

POSTED BY: Adam Strzebonski
Posted 1 month ago

Do you think Mathematica should develop this function to calculate this kind of function?

POSTED BY: Zhenyu Zeng

The answer of Solve is rubbish, and the reason may be that you fed it a integral functional equation, for which Solve is not prepared.

Here is a possible derivation of the solution:

reg = ImplicitRegion[x^2 + y^2 <= y && x >= 0, {x, y}];
eq = f[x, y] == Sqrt[1 - x^2 - y^2] -
   8/Pi*Inactive[Integrate][f[x, y], Element[{x, y}, reg]]
generalFormOfF = f[x, y] :> Sqrt[1 - x^2 - y^2] + c
eq /. generalFormOfF
% // Simplify
% /. Inactive[Integrate][a_ + b_, w__] :>
  Inactive[Integrate][a, w] + Inactive[Integrate][b, w]
% /. Inactive[Integrate][c, w__] :> Integrate[c, w]
Solve[%, c]
f[x, y] == Sqrt[1 - x^2 - y^2] + c /. %[[1]]
% /.
 Inactive@Integrate -> NIntegrate

Unfortunately, the exact value of the integral seems to take a very long time.

POSTED BY: Gianluca Gorni
Posted 1 month ago

I think it's okay if the Solve function cannot solve the problem, but it's a bit unacceptable to give the wrong answer without any hint.

POSTED BY: Zhenyu Zeng
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract