cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Divide by zero only in a range variable

Highlighted

Divide by zero only in a range variable

I'm attaching a Prime 1.0 worksheet that demonstrates a problem I'm having. I'm defining a function with a program which tests for a zero input. This works fine when you invoke the function with a constant or a simple variable of zero, but not when the argument is a range variable including a zero value. Am I doing something wrong, or is there a workaround to this?

Thanks,

Gerrit

Tags (4)
11 REPLIES 11
Highlighted

Re: Divide by zero only in a range variable

Have a look at the attached if you can open it. There does seem to be a problem when units are involved.

Mike

Highlighted

Re: Divide by zero only in a range variable

Just incase you can't open the above file I save included an image for you to follow. Sorry, my Mathcad Prime 1.0 is off at the moment.

Clipboard01.jpg

Mike

Highlighted

Re: Divide by zero only in a range variable

If I vectorize my call to H(f) like you've done it works fine too, even with units. Thank you, Mike! Are you with PTC? Can I consider that this little insect has been reported?

Highlighted

Re: Divide by zero only in a range variable

If I vectorize my call to H(f) like you've done it works fine too, even with units. Thank you, Mike!

No problem at all. It works for me with units, but when I see a problem I always strip the units away and start from scratch.

Are you with PTC?

No I'm not with PTC

Can I consider that this little insect has been reported?

It's actually not a bug. The way to created your range requires the Vectorize function.

Mike

Highlighted

Re: Divide by zero only in a range variable

Against my old argument, see below. Mathcad 15 which doesn't need the vectorize function.

Clipboard01.jpg

Mike

Highlighted

Re: Divide by zero only in a range variable

I didn't recall that it did either. In fact, I've done similar things in Prime without having to vectorize. My general philosophy has always been "if it doesn't work, try vectorizing", which I didn't follow this time, alas.

I do think Prime is not quite up to snuff yet. I've seen a number of unexplainable errors, which disappear if you delete part of the equation and then re-enter the identical thing, for example. It's so nice in other ways I'm sticking with it, but it's been really difficult this morning.

Gerrit

Highlighted

Re: Divide by zero only in a range variable

I would stick with it Gerrit. Future releases will be a massive improvement.

Mike

Highlighted

Re: Divide by zero only in a range variable

Mike's Mathcad 15 example works the same in Mathcad Prime as well.

I was looking at the problem with Gerrit's worksheet, and it appears that the issue is that f is defined as 0 in the program, but f is a vector. So you can't test for 0 this way.

Mona

Highlighted

Re: Divide by zero only in a range variable

Hi Mona,

I don't see where f is defined as zero in the program (that is, in the definition of H()). There is a test for the argument being passed being zero. The definition of H as it is should accept a vector f_sub_i and return a vector of the same size, shouldn't it? And if an element of the vector is zero, the test on the first line should catch it. Or am I misunderstanding?

Gerrit

Highlighted

Re: Divide by zero only in a range variable

Mike's Mathcad 15 example works the same in Mathcad Prime as well.

Mona,

Mathcad 15 works without using the vectorize function and just using the subscript i. Mathcad Prime will not allow this. Are you getting this problem?

Mike

Highlighted

Re: Divide by zero only in a range variable

I agree! I'm looking forward to it.

Thanks again for your help,

Gerrit

Announcements