Help with FORTRAN error message

In summary, the conversation discusses an error message received while coding a FORTRAN program. The error is caused by an invalid character in the code and the use of the incorrect exponentiation operator. The solution is to define Pi and use the double * operator instead of the ^ character.
  • #1
Daniel1992
22
0

Homework Statement



I get the follwing error message in the FORTRAN program I am trying to code.

P(i)=(1/(sigma*sqrt(2*Pi)))*e^(-(x-xbar)^2/(2*sigma^2))
----------------------------1
Error: Invalid character in name at (1)

I assume this means there is something it doesn't like about 2*Pi but I can't work out what it is.

Any help would be appreciated.
 
Physics news on Phys.org
  • #2
1 Pi should be defined elsewhere in your program, as should the constant e.
2. the character ^ is not used for exponentiation. The double * is the proper operator, thus x*x = x**2.
 
  • #3
Well that was abvious :rolleyes:

forgot that '**' is used to creates powers.

Thanks for that :)
 

Question 1: What is FORTRAN and why am I receiving an error message?

FORTRAN (short for Formula Translation) is a programming language commonly used for scientific and engineering computations. The error message is displayed when the compiler encounters a problem with the code written in FORTRAN, such as a syntax error or invalid input.

Question 2: How do I interpret the FORTRAN error message?

The FORTRAN error message typically contains a line number and a brief description of the error. You can refer to the FORTRAN language documentation or online resources to understand the error and how to fix it.

Question 3: Why is my FORTRAN code not running despite fixing the error mentioned in the error message?

Sometimes, fixing one error can reveal another error in the code. Make sure to carefully check your code for any other errors and fix them accordingly.

Question 4: How can I prevent FORTRAN error messages in the future?

The best way to avoid FORTRAN error messages is to write clean and organized code. Use proper indentation, comments, and follow the syntax rules of the language. Additionally, testing your code frequently can help catch potential errors before they become bigger problems.

Question 5: Can I get help with FORTRAN error messages?

Yes, there are various online resources and forums where you can ask for help with FORTRAN error messages. You can also seek assistance from a fellow programmer or a professional who is familiar with the FORTRAN programming language.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Programming and Computer Science
Replies
8
Views
143
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
9
Views
1K
  • Programming and Computer Science
Replies
4
Views
615
Back
Top