FORTRAN PROGRAM FOR MEANS (Beginner)

In summary, the speaker is having trouble writing a Fortran program to calculate various means for a set of numbers. They have successfully written a program for calculating the arithmetic mean for 3 numbers, but are struggling to do it for a larger set of numbers. They ask for help and mention a previous thread where they discussed a similar program. They also mention having trouble with the arithmetic calculations.
  • #1
rk2ray
9
0
I am learning Fortran and I am able to write code for 3 number means. Now For computing it for set of numbers is not getting in my mind. I am not able to do it.

Writing a single Fortran program that calculates the arithmetic mean, rms (root-mean-square) average, geometric mean, and harmonic mean for a set of numbers. Running the code for the following four sets of numbers.
(a) 4, 4, 4, 4, 4, 4, 4
(b) 4, 3, 4, 5, 4, 3, 5
(c) 4, 1, 4, 7, 4, 1, 7
(d) 1, 2, 3, 4, 5, 6, 7

Thanks for the help.
 
Technology news on Phys.org
  • #2
Can you post what you have done so far?
 
  • #4
You've already programmed the formulas. Are you having trouble doing the arithmetic?
 
  • #5


I understand that learning a new programming language can be challenging, especially when it comes to more complex tasks such as computing means for a set of numbers. However, with practice and dedication, I am confident that you will be able to successfully write a Fortran program that can calculate means for any given set of numbers.

To start, I recommend breaking down the problem into smaller steps and tackling them one at a time. First, try writing a code that calculates the arithmetic mean for a set of numbers. Once you have that working, you can move on to adding in calculations for the other types of means (rms, geometric, and harmonic).

It may also be helpful to do some research and look for examples of similar programs written in Fortran. This can give you a better understanding of how to structure your code and what functions or commands to use.

Additionally, practicing with different sets of numbers, such as the ones provided in the prompt, will help you test and improve your code. Don't be afraid to make mistakes and learn from them.

Overall, keep at it and don't get discouraged. With persistence and effort, you will be able to successfully write a Fortran program for means. Best of luck!
 

1. What is FORTRAN?

FORTRAN (short for Formula Translation) is a high-level programming language designed for scientific and engineering applications. It was developed in the 1950s and is one of the oldest programming languages still in use today.

2. What is a FORTRAN program for means?

A FORTRAN program for means is a program that calculates the mean or average value of a set of numbers. It can be used to find the mean of any type of data, such as temperature readings, test scores, or financial data.

3. How do I write a FORTRAN program for means?

To write a FORTRAN program for means, you will need to use a text editor to write the program in the FORTRAN language. The program should include a loop to read in the data, calculate the mean, and print the result. It is also important to include comments to make the code more readable and to help others understand your program.

4. Can I use FORTRAN for statistical analysis?

Yes, FORTRAN can be used for statistical analysis. It has built-in functions for basic statistical operations such as mean, standard deviation, and correlation. Additionally, there are libraries and modules available that provide more advanced statistical functions for FORTRAN programs.

5. Is FORTRAN suitable for beginners?

While FORTRAN may not be as popular as newer programming languages, it is still widely used in scientific and engineering fields. It has a simple and easy-to-learn syntax, making it suitable for beginners. However, it may require some additional effort to master certain concepts such as array indexing and subroutines.

Similar threads

  • Programming and Computer Science
2
Replies
37
Views
3K
  • Programming and Computer Science
Replies
27
Views
2K
  • Programming and Computer Science
Replies
4
Views
861
  • Programming and Computer Science
Replies
34
Views
2K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
Replies
4
Views
585
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
29
Views
1K
Back
Top