# HP Forums

Full Version: incorrect integral of 1/(sin x)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I'm getting an error while integrating 1/(sinx).

the result is -.5 ln (cos(x)+1 +.5 ln (cos(x)-1)

funny, as integral tables give the answer as -ln (cotx cscx).

Is it just a fact of life that since algorithms for integrating are so complex that you just can't expect calculators to do it?

That is a correct integral of 1/(sin x). Just differentiate the expression and you will find that it indeed is correct. When evaluating indefinite integrals, recall that your solution is acutally a family of solutions (due to the "+C"). Since many trig functions also have identities involving other trig functions, it is often the case that you may have seemingly two different antiderivatives.

For example, the antiderivative of (sin x)*(cos x) is both .5*(sin x)^2+C1 as well as -.5*(cos x)^2+C2. The reason: (sin t)^2 + (cos t)^2 = 1. By choosing just the right values for C1 (or C2) you can get from one solution to the other via the trig identity above. (Differentiate either expression and you get back (sin x)*(cos x).)

It's not an error.

[applying the ABS]

-0.5 ( log (cos(x) + 1) + log (1 - cos(x)) )

=

0.5 log( (1 - cos(x))/( cos(x) + 1 ) )

=

[multiply top and bottom by 1 - cos(x)]

0.5 log ( (cos(x) - 1)^2 / (1 - cos(x)^2) )

=

0.5 log ( (cos(x) - 1)^2 / sin(x)^2 )

=

log ( (cos(x) - 1)/ sin(x))

= log( cotangent(x) - cosecant(x) )

So, there is no error. It's the exact same function, only written differently.

For the same integral, the TI89 gives another form: log(tan(x/2))

Now, THIS is a good thread, with a good question and some excellent replies!

If this thread was made a chapter in calculus texts, in bold print no less, I think less kids would drop the course! (And some not-so-swift instructors smarten up!)

Oh, and I forgot... it even ties into HP calculators! LOL!!

(P.S. I really shouldn't comment; I usually do integrals and derivatives by hand... else use a computer... except in my old college days, doing a numerical evaluation of a rather simple integral using the SOLVE function on my old HP 34C! I have yet to try out either integrals or derivatives on a 48G+ or 49G+; and on a day I have some nerve, I'll try it on the 33S!)

It is correct. There are two good quick ways to check if the antiderivative your 49 has given you is valid:

One is as stated above, take the derivative and see if you get back the function you started with. That is the classic math approach, is absolutely valid, although some algebraic simplification may be needed for complicated functions.

Another method is to use a second computer algebra system, such as Mathematica or Maple. ( The 49 was originally programmed using Maple, and it's suprising to see how close the 49 is to Maple (versions 6 thru 8) on many things.) Integrate your function with the other CAS, then plugging in small numbers, such as x=1,2,3... and Pi/(8,4,2) for trig functions, see if the functions are equal. I'm impressed at the accuracy of the 49's antiderivatives. There are a number of errors, but relatively few. The math professor who programmed the 49 did a superb job with indefinite integration, using partial implementation of the Risch algorithm.

The TI89 is often mentioned in comparison to the 49 with regards to integration. The TI89 is generally faster but lacks the Risch methods, instead relying on plug and chug heuristics. There are a number of antiderivatives the TI89 can't do the 49 can, and vice versa. The only area where the 89 outperforms the 49 is with multiple integrals, being much faster. In the final result, though, they are both fairly well matched. An engineer is well armed with either one.

As for integration tables, there is really only one that I use, Gradshteyn and Reyshik's Table Of Integrals, Series and Products. While the table is mostly accurate, there are a number of well-known errors found by programmers when testing the integration powers of Mathematica.

Edited: 19 Nov 2005, 3:10 p.m.

J.C. --

You don't mention what kind of calculator you're using (or even if it's an HP). My HP-48G cannot solve it symbolically, but my HP-49G gives an expression that corresponds to

```-((LN(COS(x)+1)-LN(COS(x)-1)))/2,   (where x = uppper limit)
```

I'd say that there are editing errors in both the calculator solution and the integral-table solutions you listed.

The Schaum's outline Mathematical Handbook lists the integral of csc (x) [= 1/sin(x)] in equation 14.461 as

`ln (csc(x) - cot(x)) = ln (tan(x/2))`

As others have pointed out, all three forms can be equated by trigonometric identities.

-- KS

Edited: 19 Nov 2005, 3:14 p.m.

His 49's answer is correct. His table solution is an obvious error.

-((LN(Cos(x)+1)-LN(Cos(x)-1)))/2,LN(Csc(x)-Cot(x)),LN(Tan(x/2)) evaluated at x=2 all approximate to .443022...

Maple agrees.

I assumed his table answer of

-ln (cotx cscx)

was a typo and was intended to be

ln (cotx - cscx).

It's the only thing that makes sense, expecially since even if that was the answer, why write it that way? The negative in front of the log would turn cot to tan, and csc to sin, which are the more "normal" trig functions.

His HP-49(?) answer was missing a right paren after the first term -- unbalanced parentheses.

-- KS

Quote:
For the same integral, the TI89 gives another form: log(tan(x/2))

This is the result that Derive 6 on my PC returns.

My TI Voyage 200 returns: ln( |sin(x)|/|cos(x)+1| ) (with AMS 3.1)

Same is true for my TI-89 (AMS 2.09)

I have no idea, why the TI uses || (ABS) on the term cos(x)+1 which can never be negative.

Marcus