Solving Gas Dynamics Equation with Secant Method - Troubleshooting Float Error

  • Thread starter trish129
  • Start date
  • Tags
    Error
In summary, the conversation is about a Fortran code for a gas dynamics equation using the secant method. One person is having trouble with a float error and has attached the code and question, while the other person is asking for help with correcting the mistake in their code. The conversation also references a link for Fortran functions and subroutines. There is also confusion about how two individuals have the same document for the problem.
  • #1
trish129
2
0
please help mee remove this error

i coded a secantt method ..the function was a gas dynamics equation.on executing it is giving me an error:float error...

i have attached both the question and the code..

thank u..
 

Attachments

  • myquestion.doc
    84.5 KB · Views: 191
Technology news on Phys.org
  • #2
please help me correct this error in fortran

hey i coded secant method in fortran ...the equation was quite big and diffocult to put in..someow managed to do it..but on execution it is giving errors..please can you correct the mistake..thank you..would be a great learning for you...

heres the file containing the image of the equation and the fortran code..

erro:math erorr..floating error..

where am i wrong in the code
 

Attachments

  • myquestion.doc
    84.5 KB · Views: 169
Last edited by a moderator:
  • #3


Where you think you are defining a function, you are actually attempting to assign values an array that you haven't declared.

Code:
!C     DEFINE FUNCTION F
      F(M_20)=10-(6**(1/2))*(atan((((M_20)**2)-1)/6)**(1/2))-((atan((((m_1)**2)-1)/6)**(1/2)))+(atan((((M_20)**2)-

1)**(1/2))-(atan((((m_1)**2)-1)**(1/2))))


Here's a link to a topic on Fortran functions and subroutines: http://www.livephysics.com/computational-physics/fortran/fortran-subroutines-and-functions.html
 
  • #4


trish129 said:
i coded a secantt method ..the function was a gas dynamics equation.on executing it is giving me an error:float error...

i have attached both the question and the code..

thank u..

fahad20 said:
hey i coded secant method in fortran ...the equation was quite big and diffocult to put in..someow managed to do it..but on execution it is giving errors..please can you correct the mistake..thank you..would be a great learning for you...

heres the file containing the image of the equation and the fortran code..

erro:math erorr..floating error..

where am i wrong in the code

How is it that you both independently coded up this problem, and have exactly the same document? :grumpy:
 
  • #5


I understand the frustration of encountering errors in our calculations. In this case, the float error is most likely due to the limitations of floating-point numbers in computer calculations. This means that the numbers involved in your gas dynamics equation are too large or too small to be accurately represented in the computer's memory.

To troubleshoot this issue, there are a few things you can try. First, check the values of your variables and make sure they are within the range of floating-point numbers. If they are not, you may need to use a different data type or scaling factor to handle the values.

Another solution is to use a library or package that supports arbitrary-precision arithmetic, which can handle larger numbers with more precision. This will require some modifications to your code, but it may be worth considering if your gas dynamics equation involves very large or small numbers.

You can also try increasing the precision of your floating-point numbers by using double or long double instead of float. This can help reduce the error, but it may not completely eliminate it.

Finally, it is important to carefully check your code for any potential errors or bugs that may be causing the float error. Double-check your equations and make sure they are correct, and also check for any potential division by zero or other mathematical errors.

I hope these suggestions help you in troubleshooting the float error in your code. Remember to always double-check your calculations and consider using alternative methods or data types if necessary. Good luck with your research!
 

1. What is Gas Dynamics Equation and why is it important?

Gas Dynamics Equation is a mathematical model that describes the behavior of gases in motion. It is important because it helps us understand and predict the performance of various systems such as rockets, jet engines, and wind turbines.

2. What is the Secant Method and how does it relate to Gas Dynamics Equation?

The Secant Method is a numerical method used to find the root of a function by approximating it with secant lines. It is often used in solving Gas Dynamics Equation as it allows for an efficient and accurate solution.

3. What is a Float Error and why does it occur when solving Gas Dynamics Equation with Secant Method?

A Float Error occurs when the result of a calculation is too large to be represented by the computer's memory. This can happen when solving Gas Dynamics Equation with Secant Method if the initial guess is too far from the actual root, causing the algorithm to diverge and produce very large values.

4. How can I troubleshoot a Float Error when using the Secant Method to solve Gas Dynamics Equation?

To troubleshoot a Float Error, you can try adjusting the initial guess or using a different method such as the Bisection Method. It is also important to check for any errors in the implementation of the Secant Method and make sure the equation is correctly coded.

5. Are there any other numerical methods that can be used to solve Gas Dynamics Equation?

Yes, there are other methods such as the Newton-Raphson Method, Fixed Point Iteration, and Regula Falsi Method that can also be used to solve Gas Dynamics Equation. Each method has its own advantages and disadvantages, so it is important to choose the most appropriate one for the specific problem at hand.

Similar threads

  • Programming and Computer Science
Replies
5
Views
9K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
1
Views
672
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
4
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • Programming and Computer Science
Replies
5
Views
3K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
17
Views
2K
Back
Top