Skip to main content
1-Visitor
January 5, 2020
Question

Divide by zero

  • January 5, 2020
  • 2 replies
  • 8432 views

Hello 

URGENT HELP NEEDED!

I have this expression and conditions

manjulavijh_2-1578200090117.png

 

manjulavijh_3-1578200149723.png

phi has conditonal values depending on L. Since L is in the denominator, and is varied from 0-30 nm and more. this expression is giving divide by zero error. How can I compute the valus of phi. I want to plot potential (phi) againt L.

Please help

Thank you

 

2 replies

21-Topaz II
January 5, 2020

Hi

 

For a start you have named both functions the same.  Rename the second one.

 

Regards

Terry

1-Visitor
January 5, 2020

Hi Terry 

thank you for your response

i did that

 

manjulavijh_0-1578209838292.png

manjulavijh_1-1578209867241.png

manjulavijh_2-1578209879754.png

 

It sayd thie expression in RED has to be scalar

I want to plot phi wrt L

21-Topaz II
January 5, 2020

Hi,

 

Now turn the equation in red into a vectorised equation.  This will get a vector of answers. highlight the red equation and press [Ctrl][-].

 

Regards

Terry

25-Diamond I
January 5, 2020

You wrote 0*10^-9 twice in your function.

Didn't you mean 1*10^-9 or simply 10^-9 ?

Because the way you wrote it, in case of L=0 phi2 is tried to evaluated and this of course must fail.

If 0*10^-9 was done on purpose, you should apply Luc's suggestion (changing < to <= and vice versa according).

 

It should not be really necessary to rename the second function but its definitely good habit to do so, to use different names for different things.

 

If your goal is simply to plot phi over L, you don't necessarily need to define a range for L - you may use Mathcad's quickplot feature (using L for plotting without defining it)  and set the range for L directly in the plot.

If you need the range for L to have more control over the spacing of the values, you should NOT follow the definition of L by an evaluation (the = sign). This evaluation turns the range into a vector (an undocumented feature) and is the reason you need to use vectorization when you calculate phi with this vector.

If you don't turn L into a vector, no vectorization is necessary when calculating phi.

 

BTW, you could really help us in our attempts to help you by attaching your worksheet, if possible.

 

 

1-Visitor
January 5, 2020

Hey Okay

I have done quickplot. but there is some problem still. can you plz look into it

thanks in advance