Unable to find analytical solution to integral
Show older comments
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)
Accepted Answer
More Answers (1)
Rebecca Krosnick
on 23 Dec 2015
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.
1 Comment
Lucas Giering
on 4 Jan 2016
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!