How to solve improper integral '1/sin(x)' at region with variables

7 views (last 30 days)
I'd like to solve
syms x h
int(1/sin(x), x, h, 1) %%when 0<h<1
But matlab can't solve it. Probably because it doesn't consider the region of 'h'. So during the calculation it has infinite value.
Contrastively, the integral works for
syms x h
int(sin(x), x, h, 1)
ans =
cos(h) - cos(1)
Is there any good method to give simply a condition for 'h'?
As a second alternative plan(not really what i prefer,though) , i tried
syms x h
h=0.2:0.2:0.8;
int(1/sin(x), x, h, 1)
But It gave me errors for different reasons. I'll appreciate for any help. Thanks

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 24 May 2016
For rational functions of trigonometric functions use the substitution z = tan(x/2) - see for example:
  2 Comments
Chanho Jeong
Chanho Jeong on 24 May 2016
You gave me the perfect answer. Thanks But actually I'm trying to solve the following integral
syms h py
int(-3200*(1 - (h - 40)^2/(1600*sin(py)^2))^(1/2), py, -asin(h/40 - 1), 43/25)
I substituted t=tan(py/2) following your answer but it doesn't give me the answer.
int((-3200*(1 - (h - 40)^2/(1600*(2*t/(1+t^2))^2))^(1/2))*2/(1+t^2), t, tan((-asin(h/40 - 1))/2), tan(43/50))
ans =
int(-(6400*(1 - ((t^2 + 1)^2*(h - 40)^2)/(6400*t^2))^(1/2))/(t^2 + 1), t, -tan(asin(h/40 - 1)/2), 5231182527675565/4503599627370496)
Do you mind helping me a little bit more about this? Thanks
Bjorn Gustavsson
Bjorn Gustavsson on 24 May 2016
If you try pretty on the integrand you'll see that it's a bit complicated with the square root...
pretty((-3200*(1 - (h - 40)^2/(1600*(2*t/(1+t^2))^2))^(1/2))*2/(1+t^2))
That indicates that a symbolic integral might be difficult to find, try some handbooks to see if this is something "well-known"...
HTH

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!