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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Syntax change from 2001i to MC13 for solve block

azikorus-disabl
1-Newbie

Syntax change from 2001i to MC13 for solve block

Collab,

It's been a while since I've posted, however, I need your help again.

Attached is a file that was created in MC2001i several years ago. It worked fine using MC2001i as I used the calculations to create a test load test fixture.

I have been asked to modify some of the test load values and much to my surprise, the solve block no longer works in MC13. (I don't have MC2001i installed anymore)

Does anyone in the Collab know how to modify my worksheet to work in MC13?

Many thanks,

Art
23 REPLIES 23

Just a comment - it works OK in MCAD2001i and also in MCAD14M020; the issue must be unique to MCAD13, which I don't have.
Jim S.

On 1/29/2010 5:51:26 PM, Offroc wrote:

>Just a comment - it works OK

>in MCAD2001i and also in

>MCAD14M020; the issue must be

>unique to MCAD13, which I

>don't have.

>Jim S.



I get a different error here with Mathcad14 M030



RMix


On 1/30/2010 5:30:29 AM, rmix22 wrote:

>I get a
>different error here with Mathcad14
>M030

Mathcad 14 solve blocks only have one error message: that one. It doesn't matter what the problem actually is, it will always tell you that a a variable is undefined.

Richard
RichardJ
19-Tanzanite
(To:ptc-1214470)

On 1/29/2010 5:51:26 PM, Offroc wrote:
>Just a comment - it works OK
>in MCAD2001i and also in
>MCAD14M020; the issue must be
>unique to MCAD13, which I
>don't have.

Are you sure? I would be very surprised if it did. It should not work in any version past 11.

Richard


Sorry about that - my quick look was clearly too quick. It doesn't work in MCAD14M020. My first reponse obviously SUCs.
Jim S.

On 1/30/2010 6:39:17 PM, jmG wrote:
>Would it work if you remove units in
>MCAD14M020 ?
>
>jmG

It seems to get through the find function but then has units problems - I'm afraid I haven't dealt with MCAD14 units enoough to understand what is going on. I guess that's one reason I generally stick to 2001i.
Jim S.

RichardJ
19-Tanzanite
(To:ptc-1214470)

On 1/30/2010 6:39:17 PM, jmG wrote:

>Would it work if you remove units in
>MCAD14M020 ?

Since it's a problem with the way units are handled (i.e. SUC), obviously.

Richard

You have been bitten by SUC. The attached fixes it (but will not work in version 11).

Richard

An alternative approach (which will work in Mathcad 11).

stv

On 1/31/2010 9:12:56 AM, stv wrote:
>An alternative approach (which
>will work in Mathcad 11).

Your alternative have the same problem that have the first given/find block in the Richard's sheet: mathcad 14 numerical solver can't return the correct value for the first variable, when mathcad 11, and by obscure reasons to me, can do the job.

Actually I more comfortable with mathcad 14 answer: one equation, two variables, then adjust the answer to only one, and the other remains without change (in the example it is RL = 4.7).

This is the same that the mathcad 11 symbolic answer, with a very nice value for LL but returns RL -the same- for RL; the symbolic answer shows that the system have one deg of freedom.

Richard handle this issue equating Re and Im separatelly, but at both sides of the equation, when the usual is using Re & Im but for only one side. I understand why this must to do for solve by hand but have not idea about why the numerical solver now works with "two" equations that actually are the same.

As note: mathcad helps says that for complex solutions guess must to be complex, which is the case here, but the target function have also complexes, so following that correct answer is hard to me, at least without the source code for the solver.

Regards. Alvaro.
RichardJ
19-Tanzanite
(To:AlvaroDíaz)

On 1/31/2010 12:16:40 PM, adiaz wrote:
>On 1/31/2010 9:12:56 AM, stv wrote:
>>An alternative approach (which
>>will work in Mathcad 11).
>
>Your alternative have the same problem
>that have the first given/find block in
>the Richard's sheet: mathcad 14
>numerical solver can't return the
>correct value for the first variable,
>when mathcad 11, and by obscure reasons
>to me, can do the job.

Mathcad 11 does not allow mixed units in a vector, but they implemented a special case. If you have X:find(A,B), and A and B have different units, it would work. You could not evaluate X directly though, you had to evaluate X[0 and X[1. When they implemented SUC in version 12 the special case was done away with (I don't know why; could be an omission, could be because they either didn't want to implement it or couldn't figure out how).

>Actually I more comfortable with mathcad
>14 answer: one equation, two variables,
>then adjust the answer to only one, and
>the other remains without change (in the
>example it is RL = 4.7).

Yikes, you are right! I thought it was just really bad roundoff errors. I should have looked more carefully.

You don't have one equation, although superficially it looks that way. You have two equations, because you can always equate the real an imaginary parts. Mathcad 11 handles this just fine, and returns the correct answer for both variables. Mathcad 13 gets it wrong. I consider this a bug (a bad one) that was presumably introduced when the rewrote the compute engine in version 12.

>This is the same that the mathcad 11
>symbolic answer, with a very nice value
>for LL but returns RL -the same- for RL;
>the symbolic answer shows that the
>system have one deg of freedom.

When I try a symbolic solve it either chews forever if I include units (I gave up waiting for an answer), or gives an error if I use stv's version with no units.

>Richard handle this issue equating Re
>and Im separatelly, but at both sides of
>the equation, when the usual is using Re
>& Im but for only one side. I understand
>why this must to do for solve by hand
>but have not idea about why the
>numerical solver now works with "two"
>equations that actually are the same.

What do you mean? The two equations are different. One is the real part, one is the imaginary part.

Richard


>>Mathcad 11 handles this just fine, and returns the correct answer for both variables. Mathcad 13 gets it wrong.<<

Did MC13 get an actually wrong answer, or did it merely return complex results? MC13, if it sees a complex number in the constraints, will wander off in the complex plane for a solution. While this is highly undesirable, and often produces useless results (what do you do with a complex inductance?) it's not quite the same as getting a mathematically incorrect result.
__________________
� � � � Tom Gutman

On 1/31/2010 5:08:45 PM, Tom_Gutman wrote:


>>>Mathcad 11 handles this just fine, and returns the correct answer for both variables. Mathcad 13 gets it wrong.<<

>Did MC13 get an actually wrong
>answer, or did it merely
>return complex results?

I think that what Richard did is that with ZZ=Z(R,L) mathcad 11 returns the correct answer, but mathcad 14 (I don't have 13, and 14 taken by a friend) returns RL = 4.7 (untouched), like the symbolic solver in mathcad 11.

Splitting the equation (both in mc 11 & 13) into Re and Im parts make mc14 to understand what mc11 'knows' - that for numerical solvers.

>While this is highly undesirable, and often produces useless results (what do you do with a complex inductance?)

Z = R +jwL is the impedance, then:

Re(Z) = R and Im(Z) = wL

For the usual alternate current w is constant. Because u*v and 1/v for u,v complex have an easy geometrical interpretation the use of impedances are very popular to enable electricians installers to make their calculus with a minimum mathematical background and in a graphical fashion way.

So, inductances are usually taken as pure imaginary values.

Above split in ReIm parts is the 'usual', but the method in the problem is one of three:

1- Take advantages of the advanced knowledge of numerical implementation of the mathcad numerical solver (and in the case mc14 is recovered taking Re and Im of the same equation).

2- There are an implicit assumption somewhere that mc11 take -badly- and splitting equations forces mc14 to make also -badly again, but excusable and with much more sense.

3- Is wrong.

Because doing the problem by hand I get the same numerical solution, I assume that the method is valid. What I can't do is write the mysterious implicit assumption, like some Re or Im = 0, and the complex guessing for a complex equation collapses my understanding of the mc numerical solver. That for 1 and 2.

The argument that I found for 3 is better explained by the figure



Regards. Alvaro.

>>So, inductances are usually taken as pure imaginary values.<<

NO. Inductances are always real numbers. The impedance of an inductor is a pure imaginary value. That is not the same as the inductance itself.
__________________
� � � � Tom Gutman

On 2/1/2010 1:30:10 AM, Tom_Gutman wrote:
>>>So, inductances are usually taken as pure imaginary values.<<

>NO. Inductances are always
>real numbers. The impedance
>of an inductor is a pure
>imaginary value. That is not
>the same as the inductance
>itself.

Absolutely true, you're right.

Regards. Alvaro.
RichardJ
19-Tanzanite
(To:AlvaroDíaz)

On 2/1/2010 12:53:01 AM, adiaz wrote:

3- Is wrong.

>Because doing the
>problem by hand I get the same numerical
>solution, I assume that the method is
>valid. What I can't do is write the
>mysterious implicit assumption, like
>some Re or Im = 0, and the complex
>guessing for a complex equation
>collapses my understanding of the mc
>numerical solver. That for 1 and 2.

The
>argument that I found for 3 is better
>explained by the figure

If A+Bi=C+Di then it is true that A=C and B=D, but only if A, B, C, and D are real. The symbolic solver is not making any assumption about the domain of x or y, so it is correct.

In Mathcad 11, if you give it real guesses it searches only the reals for a solution. The single equation can therefore be decomposed to two independent equations, and it finds the desired solution. In Mathcad 12 and later, if it sees complex constraints then even with real guesses it searches the complex plane for a solution (contrary to what the help says). so there are an infinite number of solutions. When I split the equation into it's real and imaginary parts the solver saw only real constraints and real guesses, and found the desired solution. You can get the same result from the original solve block by adding constraints Im(RL)=0 and IM(LL)=0

Richard

On 2/1/2010 11:06:12 AM, rijackson wrote:
>If A+Bi=C+Di then it is true that A=C
>and B=D, but only if A, B, C, and D are
>real. The symbolic solver is not making
>any assumption about the domain of x or
>y, so it is correct.

Symbolic answer is ok for me (1 DOF).

>In Mathcad 11, if ...

If ... you want a solution, then mc11 have almost always a good one.

>In Mathcad 12 and later, if ...

If ... you want a solution needs patience and good loocky.

> .. it sees complex constraints then even with real guesses it searches the complex plane for a solution (contrary to what the help says).

That's the point, then: I take this affirmation as religion, but mathcad 14 (and 13 & 12) are bad.

>You can get the same result from the original solve block by adding constraints Im(RL)=0 and IM(LL)=0

Well, that's actually are the assumptions to add to the original equation, I try with only one at time but not both toghether because I'm search 2 eq with 2 unknows. If mathcad's 14 numerical solver works with this 3 equations I'm think that it is all ok. Also they are more clear to me and soft to explain why it is need to be added.

Thanks Richard, for me it is clear now that by hand I make also the assumptions Im(R)=0 and Re(jwL)=0, both, and can't discard some one into the translation to mathcad coding.

Regards. Alvaro.

>>because I'm search 2 eq with 2 unknows<<

Actually, you have to match degrees of freedom, not raw number of equations. A scalar equation with real values represents one degree of freedom. A scalar equation with complex values represents two degrees of freedom. An array equation multiplies that by the number of elements in the array. Similarly a real unknown is one degree of freedom, a complex unknown is two degrees of freedom, and an array unkown multiplies that by the number of elements in the array.

In the original formulation there is one complex xonstraint, representing two degrees of freedom. With the two unknowns restricted to real numbers (as they should be) they represent two degrees of freedom and degrees of freedom work out. If the unknowns are allowed to go complex (as MC13 and 14 do) they then represent four degrees of freedom. Hence an underdetermined system and multiple solutions.

Richard's original solution replaced the single complex condition with two real conditions, still two degrees of freedom. But with this change the unknowns are restricted to reals, hence represent a matching two degrees of freedom. Your addition constraints (to force the imaginary part to zero) are each a real constraint, representing one degree of freedom. Since you have two excess degrees of freedom to deal with, you need two such constraints.
__________________
� � � � Tom Gutman
RichardJ
19-Tanzanite
(To:TomGutman)

Very good explanation 🙂

Richard

On 2/2/2010 2:29:37 AM, Tom_Gutman wrote:
>>>because I'm search 2 eq with 2 unknows<<

>Actually, you have to match degrees of freedom, not raw number of equations.

Yes, and the because word is explaining why I fail impossing only one restriction over the domain, when the problem needs two to make it determinated, in the way that I trying to rewrite the solution that evidently works (taking Re and Im of the same equation), but without a full understanding about what is happen can lead to errors.

>A scalar equation ...

A very good explanation.

>Richard's original solution ...
>Your addition constraints ...

Both are from Richard's, I do the analysis after seeing the solution, and actually the second, my favorite, was never posted as a worksheet, which evidently close the analysis. Both together shows how to handle complex equations with complex guesses to give real physical measures in mathcad 14. So, an important example here.

This is like all engineering problems: after one see the solution seems to be easy.

Regards. Alvaro.
RichardJ
19-Tanzanite
(To:TomGutman)

On 1/31/2010 5:08:45 PM, Tom_Gutman wrote:

>Did MC13 get an actually wrong
>answer, or did it merely
>return complex results? MC13,
>if it sees a complex number in
>the constraints, will wander
>off in the complex plane for a
>solution. While this is
>highly undesirable, and often
>produces useless results (what
>do you do with a complex
>inductance?) it's not quite
>the same as getting a
>mathematically incorrect
>result.

Yes, you are correct. Although the guesses are real, it has wandered off into the complex plane to find a solution (contrary to what the help says: "If solutions are expected to be complex, complex guess values must be used", which is still incorrect in version 14). Because it's done that there are obviously an infinite number of possible solutions, so it just leaves one variable unchanged. So, apart from the incorrect help, not a bug, but a big change in behavior from version 11.

Richard

On 1/31/2010 2:56:58 PM, rijackson wrote:

>What do you mean?

See attached.

Regards. Alvaro.

Collab,

Thanks so much for the overwhelming response. Many good ideas, suggestions, and explanations.

I'll have to update my load calculating worksheets and likely upgrade to MC14.

Thanks again to all who helped.

Art
Top Tags