I just forgot to include that bracket when I was copying. It's there in my file.
Everything works, except I don't think it's calculating correctly, which is why I think the error is with the part I bolded.
I'm not sure if I should include all those parentheses, or if I can Math.pow multiple variables (like a+b/d), etc.
I have no clue about JavaScript... I just wanted to make this for my own convenience.
Thanks.
EDIT: Well, I got it... but for a different calculation. I did a different Pythagorean formula for calculating a baseball team's expected win-loss record, and here's how I did it... hopefully I can learn from it, and maybe some other people will, too.
The problem was in the part I bolded above.
Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function solvepy(form) {
a = parseInt(form.a.value);
b = parseInt(form.b.value);
form.c.value = (Math.pow(a,1.83)/(Math.pow(a,1.83)+Math.pow(b,1.83)))
}
// End -->
</script>
I had to Math.pow separately.
EDIT: How would I round the following to three digits? I tried the Math.round, multiply by 1000, divide by 1000 thing, but it just screwed the whole thing up.
Code:
form.c.value = (Math.pow(a,1.83)/(Math.pow(a,1.83)+Math.pow(b,1.83)))
Code:
form.j.value = (Math.pow(a,i)/(Math.pow(a,i)+Math.pow(b,i)));
Bookmarks