Fortran Fortran Trigonometric Function: Law of Cosines and Inverse Calculation

  • Thread starter Thread starter Benzoate
  • Start date Start date
  • Tags Tags
    Fortran
AI Thread Summary
Fortran can recognize trigonometric functions, including the inverse cosine function, which is essential for implementing the Law of Cosines. To calculate the angle 'c' using the inverse of the Law of Cosines, the correct syntax in Fortran is to use the acos() function. The equation can be expressed as c = acos((d**2 + a**2 - b**2) / (2 * a * d)). It's important to consult the Fortran documentation for specific function names, as they may vary between different dialects of the language.
Benzoate
Messages
418
Reaction score
0
I want Fortran to regconize trigonometric functions.

The trigonometric equation I am trying to right in Fortran is the Law of cosines

COS(c)=d^2+a^2-b^2/(2*a*d)
However, I want Fortran to calculate the inverse of the above equation:

How would I write the following equation in Fortran?
c=COS^1-(d^2+a^2-b^2/(2*a*d))
 
Technology news on Phys.org
You are looking for arccos - you will have to check documentation for the correct name of the function, as it differs between dialects.
 
Hi Benzoate,

The inverse cosine function is given by:

acos()
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...

Similar threads

Replies
25
Views
3K
Replies
12
Views
1K
Replies
9
Views
4K
Replies
3
Views
2K
Replies
4
Views
2K
Replies
1
Views
2K
Replies
8
Views
2K
Back
Top