# Thread: I'm having trouble getting the right answer to this ...

1. ## I'm having trouble getting the right answer to this ...

For the sake of interest only ..
I am trying to build an applicatin that will predict the position of the sun in the sky (horizontal and vertical angle) for any given date and geographical location for any of the planets in our solar system.

So far so good, but ...
The following sum, I am reliably informed, should equate to: 1.9142°

1.9148° * sin(87.1807°) + 0.0200° * sin(2 * 87.1807°) + 0.0003° * sin(3 * 87.1807°)

I am getting: -1.3721

I'm probably making a school boy error.
Any help would be welcome.

Regards

Ben Stevens

2. ## Re: I'm having trouble getting the right answer to this ...

For starters, sine is negative in the third quadrant, so the third term will be negative. Question is, is it greater in magnitude than the other two terms?

Also, have you made sure that your calculator is in degree mode?

3. ## Re: I'm having trouble getting the right answer to this ...

Hi Ben

$\displaystyle sin(87.1807°) = 0.99878962570209612689563534191579$
$\displaystyle sin(2*87.1807°) = 0.098253359368085150710143684506237$
$\displaystyle sin(3*87.1807°) = -0.98912420429733530840698149621533$
Substituting in the equation we have
$\displaystyle 1.9148° * sin(87.1807°) + 0.0200° * sin(2 * 87.1807°) + 0.0003° * sin(3 * 87.1807°)= 1.9141507052204461662014433319416$

4. ## Re: I'm having trouble getting the right answer to this ...

Many thanks Kalyanram ..
I now know that I'm wrong at least.

I am working with Visual Basic in .Net
I get the following componet parts to the equation.. which would appear to be wrong.

?Math.Sin(M)
-0.7060425903472024
?Math.Sin(2 * M)
-0.99999547679626677
?Math.Sin(3 * M)
-0.71028974892604

I should think I need to be looking at how VB calculates the SIN of a given angle.

Once again.
Many thanks

5. ## Re: I'm having trouble getting the right answer to this ...

Thanks Prove It.
I haven't checked, but I will.
As I have said in another reply, I am working in VB .Net.

Assuming kalyanram is correct, the vb .Net SIN function is returning an unexpected result.
I'm probably not using it correctly.

Once again.
Many thanks