Unable to find analytical solution to integral
조회 수: 15 (최근 30일)
이전 댓글 표시
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)
댓글 수: 0
채택된 답변
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
추가 답변 (1개)
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":
- Approximate Definite Integrals: http://www.mathworks.com/help/symbolic/int.html#zmw57dd0e70809
- vpa: http://www.mathworks.com/help/symbolic/vpa.html
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Special Values에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!