Unable to find analytical solution to integral

조회 수: 16 (최근 30일)
Lucas Giering
Lucas Giering 2015년 12월 21일
댓글: Walter Roberson 2016년 1월 4일
I am trying to solve a symbolic definite integral. I know that there has to be a solution (at least an approximate one). However, MATLAB seems to be unable to find an analytical solution of the integrals. It only returns the int(..., x=...) expression that i plug in. The only help i found in the documentation was to use taylor expansion on the function before the integration, which seems to be too much of an approximation.
Am I doing something wrong? Is there any other way to find a solution to the integral or at least a good approximation?
My code for one of the integrations:
syms a b c d E f g x y
func = a+f*x+g*y*d*(y-c)/((y-c)^2+(x-b)^2)^(1/2);
int(func(x,E),x,-E,E)

채택된 답변

Walter Roberson
Walter Roberson 2015년 12월 24일
syms a b c d E f g x y
func = a+f*x+g*y*d*(y-c)/((y-c)^2+(x-b)^2)^(1/2);
int(func,x,-E,E)
I do not know whether the Symbolic Toolbox is able to find the integral; it is
g*y*d*(-y+c)*(ln(-E-b+sqrt(E^2+2*E*b+b^2+(-y+c)^2)) - ln(E-b+sqrt(E^2-2*E*b+b^2+(-y+c)^2))) + 2*E*A
  댓글 수: 3
Walter Roberson
Walter Roberson 2016년 1월 4일
I used Maple.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Rebecca Krosnick
Rebecca Krosnick 2015년 12월 23일
You are not doing anything wrong. "int" just is not able to compute a closed form of the integral in this case. It is possible a closed form does not exist. To approximate the definite integral numerically, the documentation page suggests using "vpa":
Also, if you create the integration object and then later have numeric values to plug in for the variables, you can substitute in those numeric values and the integration object will update. As you fill in values for the variables the integration should become closed form. For example, if you start with the following definitions:
>> syms a b c d E f g x y;
>> func(x,y) = a+f*x+g*y*d*(y-c)/((y-c)^2+(x-b)^2)^(1/2);
>> integr = int(func(x,E),x,-E,E)
integr =
int(a + f*x + (E*d*g*(E - c))/((E - c)^2 + (b - x)^2)^(1/2), x, -E, E)
and then update "b" to be 2
>> integr = subs(integr, b, sym(2)) % substitute 2 for b in integr
integr =
int(a + f*x + (E*d*g*(E - c))/((x - 2)^2 + (E - c)^2)^(1/2), x, -E, E)
and "c" to be 3
>> integr = subs(integr, c, sym(3))
integr =
2*E*a - 3*E*d*g*(asinh((E - 2)/((E - 3)^2)^(1/2)) + asinh((E + 2)/((E - 3)^2)^(1/2))) + E^2*d*g*(asinh((E - 2)/((E - 3)^2)^(1/2)) + asinh((E + 2)/((E - 3)^2)^(1/2)))
"integr" now is in closed form.
  댓글 수: 1
Lucas Giering
Lucas Giering 2016년 1월 4일
Thanks for your reply, I will definitely give this a try!

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by