HARVEY HENSLEY wrote:
I know that this has been answered,
Yes, Valery again has found the Correct Answer himself 😉
Harvey, as already written I guess that the unit is responsible for the numeric algorithm taking larger steps and this may lead to inaccurate results. In our case it also seems to be responsible for the algorithm to try negative values for t2. But the unit is not responsible for Maximize to fail.
The real reason for Minimize to fail in this example is because Valery's function is returning a string for negative temperatures, Slightly change the function rho2 in your example above: just add "+0" at the end. This will not change any valid result but now for negative temperatures this function fails because it can't add a string and a number. Using this function makes Maximize() work - regardless of the unit °C.
I already showed this here http://communities.ptc.com/message/261839#261839 andI then delved a bit deeper into the subject here http://communities.ptc.com/message/261840#261840 and a new question grew up (why does "IsString()" not do the job?).
But the thread got quite confusing already and navigating in this forum isn't as easy and clearly as we were sed from the old collab.
Anyway, as a conclusion I would say that even if we can get it to work by omitting the string error message its the best idea to get rid of the unit nonetheless as you had shown in your first reply.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.



