Fortran Trigonometric Function: Law of Cosines and Inverse Calculation

  • Context: Fortran 
  • Thread starter Thread starter Benzoate
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary
SUMMARY

This discussion focuses on implementing trigonometric functions in Fortran, specifically the Law of Cosines and its inverse calculation. The equation for the Law of Cosines is expressed as COS(c) = (d² + a² - b²) / (2 * a * d). To calculate the inverse, the arccosine function, denoted as acos(), is utilized. Users are advised to consult the Fortran documentation for the correct function names, as they may vary across different dialects.

PREREQUISITES
  • Understanding of Fortran programming language
  • Familiarity with trigonometric functions
  • Knowledge of the Law of Cosines
  • Ability to read and interpret mathematical equations
NEXT STEPS
  • Research the Fortran documentation for trigonometric functions
  • Learn how to implement the acos() function in Fortran
  • Explore examples of the Law of Cosines in Fortran
  • Investigate differences in trigonometric function names across Fortran dialects
USEFUL FOR

This discussion is beneficial for Fortran programmers, mathematicians applying trigonometric functions, and anyone interested in implementing mathematical equations in programming.

Benzoate
Messages
420
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()
 

Similar threads

  • · Replies 25 ·
Replies
25
Views
4K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 4 ·
Replies
4
Views
8K
  • · Replies 37 ·
2
Replies
37
Views
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K