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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Bug in Prime 3 using regressions with units?

Werner_E
24-Ruby V

Bug in Prime 3 using regressions with units?

As we know Prime in general has a better and more consequent handling of units than Mathcad 15 (units of different dimension in a matrix, odesolve with units, ...). Nevertheless units still don't seem to be integrated that seamless as we'd like it to be.

Playing around with a worksheet from another thread with a question about curve fitting I found that genfit() doesn't calculate the correct results if used with units (which I guess should be possible to do in Prime).

Is it a bug or am I missing something? See the attached file.

22.02.png

16 REPLIES 16
RichardJ
19-Tanzanite
(To:Werner_E)

I think it has to do with the scaling. If you divide Volume by m^3, the base unit, you get garbage results (although they are different to v2). Changing CTOL has no effect on those results though.

If we divide by m^3 we have to change the related guess values (first and fourth from 1000 to 1) accordingly and also add the unit m^3 when defining the function f. That way I get the very same result. Interestingly the coefficients are now switched index0 <--> index 4, index1 <--> index5, etc. which doesn't matter because of the symmetric nature of the fit function.

BTW, CTOL has no influence but changing TOL has!

RichardJ
19-Tanzanite
(To:Werner_E)

When I first open the attached sheet I see this;

units problem.png

If I move the first two regions down until they are after the second two, the second evaluation of vg2 changes so that the two evaluations match. If I then move the two regions back to the top, the two evaluations still match. Do you also see this, or is it just my installation? I see similar weird effects in your genfit worksheets.

Edit: I can the two evaluations to match just by hitting Ctrl F9

RichardJ
19-Tanzanite
(To:RichardJ)

Here's what I see in one of your (slightly modified) genfit worksheets:

units problem2.png

It does not matter which order the two definitions of vg2 are in, and even disabling the one with the transpose does not make the evaluation match the definition. Ctrl F9 also has no effect.

Thats spooky. I can confirm that behaviour, too. After inserting a new, identical, definition of vg2 using a row vector every evaluation of vg2 show the same wrong values I see in your screenshot. Even deleting that new definition would not change anything. Whats going on here?

I can confirm that I can duplicate the effects you describe and see the very same values.

It seems that autocalculation works differently in Prime compared to Mathcad. When you open a file you see the last calculation which was done before saving, the sheet is not automatically recalculated when opened (otherwise Prime Express would not be able to display sheets using premium content).

But if anything is done which would require a recalculation like disabling or moving away the first definition of vg2, autocalc will do its work. Also moving down the secend definition of vg2 will work.

So the question is how this sheet was created with that (wrong) eval of vg2.

RichardJ
19-Tanzanite
(To:Werner_E)

From your genfot worksheet. I'll try to reproduce it. In the meantime, here's one where it's wrong, even though not as wrong. And recalculating this one does not fix it.

I already duplicated that effect in one of my sheets as desribed in my answer above.

I deleted all which seems having no effect and am now left with the data definitions, definition of function, guess vector and call of genfit and at last the eval of the guess vector.

If I delete the last 1 in the definition of the guess vector, genfit fails and the eval of vg2 shows the correct values. If I add the 1 the same weird effect is shown.

It looks like genfit() somehow modifies the guessvector on the worksheet level.

This time it matters if vg2 is evaluated before or after genfit(). (In your last sheet I think it did not matter!?)

RichardJ
19-Tanzanite
(To:Werner_E)

Weird! But I think we can definitely conclude that there is a bug in the way genfit handles units! maybe more than one.

Yes, there is definitely something wrong!

Look at the attached sheet. It looks quite normal and correct.

Now follow the instructions (changing one guess value ever so slightly) and goggle in disbelief.

RichardJ
19-Tanzanite
(To:Werner_E)

There is a really serious bug somewhere. I hope someone from PTC has been following this thread, and logs it. I don't have maintenance, so I can't.

I don't have maintenance,

Your profile say something different!?

Just opened case C11874876, but I guess this information is useless as I think I am the only one being able to look at that case.

BTW, I have just recreated the last two genfits() (those w/o the units) in MC15. Changing the -0.01 to +0.01 gives an errror as of no convergence, but changing that value to 0 give a vector with useless values, too.

25.02.png

RichardJ
19-Tanzanite
(To:Werner_E)

Your profile say something different!?

Hmm. How did that happen, since I have not paid for it in a very long time? I thought software from alpha / beta testing did not include it, but maybe I'm wrong.

Richard Jackson wrote:

... I don't have maintenance, so I can't.

Pic_1.png

You can try it: https://www.ptc.com/appserver/cs/case/case_logger.jsp

I've been loosely following this thread. "Spooky" indeed.... I've just informed tech support.

Roger Yeh wrote:

I've just informed tech support.

And about this bug please too

http://communities.ptc.com/message/234381

Top Tags