...

View Full Version : Help Wanted Math Problems

marceltinka
07-02-2006, 10:40 AM
I do not know how to use javascript math.
Is there a good explanation where complicated formulas are being discussed.

K3 = [k0sin^41" (nu) sin(lat)cos^3(lat)/24][(5 - tan^2(lat) + 9e'^2cos^2(lat) + 4e'^4cos4(lat)]
where:
sin1" = pi/(180*60*60) :)
e = SQRT(1-b2/a2)
e'2 = (ea/b)2 = e2/(1-e2)
nu = a/(1-e2sin2(lat))1/2

^2 means x² and ^3 x³ and so on...
lat, k0, nu, e' are variables...

My tries causes wrong results.

The line is an example of some lines I need.
(attached files show topic and all formulas)

May someone can help me?

Thanks

Marcel

joeframbach
07-02-2006, 10:47 PM
i am confused over this.
sin(1") = pi/(180*60*60).
shouldn't it be 1"=pi/(180*60*60)?
either way, it is so close to 0 that sin(1") approximates 1", or 4.8481368 x 10^-6, or 0.0000048481368, so we'll just use that.

Also, be very verbose when using * for multiplication and ^ for powers.
try:

K3 = [k0 * sin(1")^4 * (nu) * sin(lat) * cos(lat)^3 /24] [ 5 - tan(lat)^2 + 9 * e'^2 * cos(lat)^2 + 4 * e'^4 * cos(lat)^4]
where:
sin1" = pi/(180*60*60)
e = SQRT(1-b^2/a^2)
e'2 = (e*a/b)^2 = e^2/(1-e^2)
nu = a/(1-e^2 * sin(lat)^2) ^ (1/2)

to explain the problem. Otherwise it is very hard to decipher without really looking into the documentation provided.

Now to the solution:

var sin_one_minute = 0.0000048481368;
var e = Math.sqrt(1-b*b/a*a);
var e_prime_2 = Math.pow((e*a/b),2);
var nu = a / Math.sqrt(1 - e*e * Math.pow(Math.sin(lat),2));
K3 = (k0 * Math.pow(sin_one_minute,4) * nu * Math.sin(lat) * Math.pow(Math.cos(lat),3) / 24) * (5 - Math.pow(Math.tan(lat),2) + 9 * e_prime_2 * Math.pow(Math.cos(lat),2) + 4 * Math.pow(e_prime_2,2) * Math.pow(Math.cos(lat),4));

Note: I don't even know if this works. I just threw it together. All the necessary Math functions, Math.pow, Math.sqrt, Math.sin, Math.cos, Math.tan, are all you should need. Just note that they use radian measure and not degree measure.