Dear Forum,
I am looking for the arccos function, any suggestions?
Thanks in advance,
Eleftheria
Arccos function
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Arccos function
atan is built in. If you need arccos, you can write your own using atan.
Re: Arccos function
Thank you very much Ted, for the record this is the function I used:
Moderator's note: message edited to insert code markup.
Code: Select all
func acos() {
denom = 1 - $1 * $1
if (denom == 0.0) {
return PI/2
} else{
return PI/2 - atan($1 / sqrt(denom))
}
}
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Arccos function
I think you meant this:
Code: Select all
func acos() {
if ($1==0) {
return PI/2
} else {
return atan(sqrt(1-$1^2)/$1)
}
}