Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Divide by zero

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-04-2020
11:58 PM

01-04-2020
11:58 PM

Divide by zero

Hello

URGENT HELP NEEDED!

I have this expression and conditions

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

Labels:

18 REPLIES 18

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
02:22 AM

01-05-2020
02:22 AM

Re: Divide by zero

Hi

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

Regards

Terry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
02:38 AM

01-05-2020
02:38 AM

Re: Divide by zero

Hi Terry

thank you for your response

i did that

It sayd thie expression in RED has to be scalar

I want to plot phi wrt L

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
02:52 AM

01-05-2020
02:52 AM

Re: Divide by zero

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
02:58 AM

01-05-2020
02:58 AM

Re: Divide by zero

Hello

YEs did that

is this wat you mean?

Now this again gives an error ( Divide by ZEro)

I have given conditions for potential for L<0, 0-L-30nm, L>0

the expression of phi has L in denominator. is it because of that? Then How to i give conditions a plot over entire device?

I am new to this tool

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
03:23 AM

01-05-2020
03:23 AM

Re: Divide by zero

Hi,

Don't despair we will get there. This one is subtle.

L is on the denominator of the first function so will give an error if L is zero.

You start the definition of L the range variable with zero.

Start the definition of range variable L greater than zero.

Regards

Terry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
03:29 AM

01-05-2020
03:29 AM

Re: Divide by zero

Change phi such that the first statement says

Vbis if L ≤ 0

and the second says

phi2(...) if 0 < L ≤ 30*10^-9.

Success!

Luc

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
06:09 AM

01-05-2020
06:09 AM

Re: Divide by zero

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
06:18 AM

01-05-2020
06:18 AM

Re: Divide by zero

Hey Okay

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

thanks in advance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
07:06 AM

01-05-2020
07:06 AM

Re: Divide by zero

Hey Werner

Below is the mathcad file. Please help as it is a lil urgent. I will be thankful

Please help if you get where am i going wrong. I am unable to decide the values of x and y and changing them is making a change in the plot

the desired graph should be like this. ignore the labels in this as it is from some other simulation.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
07:18 AM

01-05-2020
07:18 AM

Re: Divide by zero

You define km:=m*pi/L. and before that you defined m:=1 and L:=30*10^-9. This means that km =pi/(30*10^-9) = pi/30 * 10^9.

Since you did NOT define km to be a function of m and L, km is and remains that constant pi/30 * 10^9 throughout the rest of the sheet.

Is this what you want?

Likewise for km1.

Then in your definition of phi2 you have a summation that essentially does nothing. Summing for m=1 to 1 is just a single term...

Success!

Luc

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
07:21 AM

01-05-2020
07:21 AM

Re: Divide by zero

km is an eigen value.

I dont know how is it to be defined. by formula is it wat it is written.

do i mk it a function?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
07:23 AM

01-05-2020
07:23 AM

Re: Divide by zero

yes the summation i have written from m=1 to 1, as if i write summation m=1 to infinity, it doesnt give a valid value of phi. it gives a much much greater value like >10^377... it gives this message. so i was trying keeping m=1 to 1

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
07:59 AM

01-05-2020
07:59 AM

Re: Divide by zero

Please help if you get where am i going wrong. I am unable to decide the values of x and y and changing them is making a change in the plot

I am not sure what you mean by that.

Obviously you got the plot to work finally.

The range you use is rather coarse, I guess using something like L:=0, 0.05*10-^9 .. 40*10^-9 could be more appropriate.

Also in your definition of Phi you allow very low values of L - as close to zero as possible. That means that your function values get lower and lower as L approaches 0 from the right. It may be appropriate to limit this by a value like 10^-9 or whatever seems feasible.

If the resulting graph is not what you expected, then something with your formulas is not OK. I can't tell what.

Turning km and km1 into functions of m may be a starting point, but even if you do so, the sum (which you limited to run from m=1 to m=1) still does not converge, so it looks like something else in your formulas is faulty, too.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
08:09 AM

01-05-2020
08:09 AM

Re: Divide by zero

HEy

L ranges from 0 to 30nm and that is why i want to see the potential in the device from this length

about km and km1, these are eigen values. i tried making them a function of m and L but it didnt give correct results.

as far as limits of summation are concerned, if i summ from 1 to infinity it gives a v large value of phi which matcad doesnt calculate

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
08:44 AM

01-05-2020
08:44 AM

Re: Divide by zero

"about km and km1, these are eigen values. i tried making them a function of m and L but it didnt give correct results."

Just making km and km1 functions doesn't help. You have to follow through. If km is a function of m and L, then so should Asn and Adn be functions of m ** and** L.

Note that when you use Asn(y) in the definition of D1m(m) you call it with parameter y, which is some length (as it is in the nano-range) whereas your variable m appears to be unitless.

I suspect there's more than one error in your formulae. I propose you start adding units to your expressions. That should help you diagnose where errors may be.

How about this as a start:

I may have set some units incorrectly. (It's been a long time that I worked with MOS models.) But I'm sure that you can correct that.

Notice how evaluation of D1m(1) produces an error. It is due to Asn and Adn being called with y instead of 1.

Success!

Luc

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
08:51 AM

01-05-2020
08:51 AM

Re: Divide by zero

Thanks, I will try that for sure

Asn

this is a fourier coefficient of source boundary potential. and has the value of that integral.

BTW ho does one add units? if you could throw some clarity on this

Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
09:10 AM

01-05-2020
09:10 AM

Re: Divide by zero

Hi

the units option inside the insert menu is disabled in mathcad sheet

i think i had earlier disabled all units.

Can you please help me to enable units as advised by you. or do i have to write every formula again?

thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-05-2020
11:33 AM

01-05-2020
11:33 AM

Re: Divide by zero

Check menu option "Tools" => "Worksheet options".

You can select the 'unit system' and whether or not 'dimensions' are shown.

Success!

Luc