Skip navigation
1068 Views 3 Replies Latest reply: Feb 16, 2012 3:00 PM by wayne RSS
JaydeepPanchal Copper 19 posts since
Sep 21, 2011
Currently Being Moderated

Feb 16, 2012 12:19 PM

Division by Zero

Hello,

 

I am stuck at one place and it gives me an error that divide by zero.

 

Facewidth has relation with pitch so in program it gives correct answer. But for after that range it gives zero value.

 

and because of the zero value it does not calculate SS which is surface stress.

 

In-short as the facewidth I need answers for SS, SB, SB1, and BHNW.

 

I am attaching the program. Please check it out. you will get more idea.

 

 

Thank you.

Jaydeep

Attachments:
  • wayne Gold 440 posts since
    Apr 22, 2010
    Currently Being Moderated
    Feb 16, 2012 1:38 PM (in response to JaydeepPanchal)
    Re: Division by Zero

    FFacewidth has 0 values, and you are dividing by that,

     

    I added a small program to sort out the 0 values.

    Attachments:
      • wayne Gold 440 posts since
        Apr 22, 2010
        Currently Being Moderated
        Feb 16, 2012 3:00 PM (in response to JaydeepPanchal)
        Re: Division by Zero

        JaydeepPanchal,

         

        I didn't check for the correct answer, just gave you a way to prevent division by 0.  I see you filled the 0's with 1's, which is fine, if that gets you want you want.

         

        Also, you could also assign NaN instead of 0 in the program, which may be better since I assume when division by 0 occurs the problem is actually not defined.  NaN points will not plot.

         

        Looks like I needed to change the index on Pitch in the program.

        Attachments:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 3 points
  • Helpful Answers - 1 points