# Correct integration formula

I'm the author of application for android called Calculator++ One of the users submitted a bug in the integration of trigonometric functions. And I'm absolutely disagree with him.

In my app I use approach to calculate trigonometric functions differently in different modes (I mean DEG/RAD modes), e.g.:

• in rad mode you can type $\sin(\pi/ 3)$ and get result $0.866$
• in deg mode you type $\sin(60°) (≡ sin(60))$ and get the same result

So, strictly speaking in different modes I've got different sin functions - in deg it is a function of degree argument and in rad mode - function of radian argument.

Calculator++ allows to get the integral of sin function and in both modes: $\int\sin(x)dx = - \cos(x)$

And here is the misunderstanding: user says that correct integration formula is:

1. RAD: $\int\sin(x)dx = - \cos(x)$
2. DEG: $\int\sin(x)dx = - \pi / 180 \times \cos(x)$ (user assumes that variable modification is needed for correct integration)

I want to ask who is correct in this argument - me or user?

-
Am I correct is saying that currently your calculator would report the following: $\int\sin(x^\circ)dx=-\cos(x^\circ)$? – matt Jan 10 '12 at 7:25
Call by the name $S(x)$ the "sine-like" function such that, for example, $S(90)=1$. Let $C(x)$ be the corresponding cosine-like function. Then $\int S(x)\,dx=(-180/\pi)C(x)+D$. – André Nicolas Jan 10 '12 at 8:39
But you're wrong: say sin(r) is a function of radian angle, say sin_d(d) is a function of degree angle, such that sin_d(r * 180 / π) = sin(r) Obviously: ∫(sin(r), r)=cos(r)+C Let's calculate integral of sin_d(d) by d variable: ∫(sin_d(d), d) = cos_d(d) + C Let's calculate integral of sin_d(d) by r variable: ∫(sin_d(d), r) = ∫(sin_d(r * 180 / π), r) = - π / 180 * cos(r) + C. – se.solovyev Jan 10 '12 at 9:40
The main difference is in the result functions: 1. In the first case we get cos_d(d) which is function of degrees, and can continue to use degrees (we are in deg mode) 2. In the second case we get cos(r) which is functions of radians, and continue to use only radians (but we are use degree mode) – se.solovyev Jan 10 '12 at 9:40

I don't think there's right or wrong there; it depends on how you describe what the trigonometric functions and the integration are supposed to do. Oddly, I would a priori tend towards your viewpoint, but based on your statement "strictly speaking in different modes I've got different sin functions" and on your equation "sin(60°) (≡ sin(60))", I'd say the user has a point: If you really do consider these as different functions, then clearly these different functions have different derivatives and anti-derivatives. (Speaking of anti-derivatives, both of your options are wrong since they're missing the integration constant.)

However, it seems to me that the most natural view isn't that these are two different functions (one of which never appears anywhere in mathematics), but that the same function is being applied to the same argument, just expressed in different units. Thus, I wouldn't drop the $^\circ$ symbol, but would consistently use it to denote an angle unit of $\pi/180$. Then the DEG mode would correspond to always implicitly adding a degree symbol to the current number before applying a trigonometric function. Then you have just one function, and the integral of that function is of course the one you give in your first option (plus a constant).

-
Thank you for answer! What you're saying is the way it is implemented now, i.e. I use only one sin function for all possible angle units (radians/degrees/gradians/turns). And it is hidden from user how the units are converted, that's why the integrals of sin in different modes are the same (we just integrate over different variable). – se.solovyev Jan 10 '12 at 9:31
@joriki: I'm not sure if I agree. The real question is what dx means, i.e., what measure one uses. I guess a typical user would want to know what $\int_0^{180} dx\, sin(x)$ (using the implicitly notation and multiplying $\pi/180$ because we are in degree mode). But then the integral clearly is $2\times 180/\pi$ (just try to draw the function and calculate the agree under the curve -- which of course is measured in degree). – Fabian Jan 10 '12 at 18:58
@Fabian: Do you agree that $\int_{0}^{90}sin(x)dx$ in DEG mode should be equal to $\int_{0}^{\frac{\pi }{2}}sin(x)dx$ in RAD mode? PS At least i think so. – se.solovyev Jan 10 '12 at 19:56
@se.solovyev: No, I don't. Try to think about the fact that the integral is equal to the area below the curve. And imagine (just for the sake of the argument) that $\sin(x)=1/2$ for all $x$. Then the area below the curve in DEG mode is 45 and in RAD mode $\pi/4$ -- just because the measure along the $x$-axis is different. In the first case, I have a square with dimensions $1/2 \times 90$ and in the second case the square has dimensions $1/2 \times \pi/2$. – Fabian Jan 10 '12 at 21:19
@Fabian: Thank you, I've understood the problem. – se.solovyev Jan 11 '12 at 17:35

The user is right in one respect: the approach you chose is inherently inconsistent. However, this inconsistency is a lesser evil and doubling the function definitions and the corresponding differentiation and integration rules would be a greater evil.

The usual convention in pure mathematics is that there is only one $\sin$ function and the degree ${}^\circ$ is just an abbreviation for "times $\frac{\pi}{180}$". So, you can input the argument in degrees and get output in degrees if you desire so but that's it. All processing is done in radians. From this point of view, Fabian's objection gets resolved pretty easily: the base is not $90$, but $90^\circ$, which is the same old $\pi/2$ though, of course, the integral has to be set up and displayed as $\int_0^{90^\circ}$, not merely as $\int_0^{90}$. Also writing $\sin 90=1$ is a bad mistake but writing $\sin 90^\circ=1$ is totally fine.

If you try to do calculus differently in different modes, everything will become so confusing that the only thing your calculator will be good for will be "making a satisfactory thump when dropped to the floor". Half of the student's computational mistakes when using calculators in the low-level trigonometry classes already come from forgetting which mode they are in (and no, that tiny squiggly indicator in the corner of the screen or whatever else you have in your application now doesn't help much) and nothing good will happen if you spread this dual interpretation elsewhere. I would really hate to lecture that "the series $\sum_{k=1}^\infty\frac{\cos 2\pi k}{k}$ diverges in the radian mode but converges in the degree mode" when teaching elementary analysis. I'd rather say "Those calculator designers went completely nuts, so bringing any kind of calculator to my class will cost you ten points deducted from your grade for each offense" instead.

A really good thing to do would be to dispose of that special degree mode altogether and have that ${}^\circ$ sign displayed after every number entered in degrees and force the user to push the corresponding ${}^\circ$ button at the process of entering each argument if he wants to work in degrees for angular computations. Unfortunately, that degree mode is very popular on the market, so that may be not an option.

Finally, if the user is so clever that he understands the inconsistency of the degree mode, he should be clever enough to be able to do everything in the radian mode without ever using the degree one, so I see no real reason for him to be unhappy.

-
Thank you for a good answer. – se.solovyev Jan 11 '12 at 7:32