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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

1-Newbie

## Using Prime 3.0, the determinant function does not handle a matrix with complex numbers. Don't how to fix it.

When I load a matrix up with al reals the |A| or det(A) works fine and returns the value.  If I add a +1i or any imaginary number to an element, the |A| or det(A) returnb 0.  This frustrating since I have programs that use this alot for filling arrays in a linear systems problem.

1 ACCEPTED SOLUTION

Accepted Solutions
23-Emerald III
(To:Fred_Kohlhepp)

Express Prime does work with complex numbers,

It understands that the middle element of B is a complex number. It can produce it's complex conjugate, but the Re() and Im() functions are considered 'Premium' function, although you can easily circumvent that by defining them using the complex conjugate.

Anyway, this is what Express Prime 3.1 produces (typed everything in myself):

Luc

51 REPLIES 51
23-Emerald I
(To:fstulen)

Hmmmm!

From my 3.0:

14-Alexandrite
(To:Fred_Kohlhepp)

I typed Fred's example into Prime 3.1: No Good

I typed Fred's example into MC15: Good

I converted MC15 to Prime 3.1: Good

I did copy/paste of converted elements into new Prime 3.1 worksheet: No Good!

24-Ruby II
(To:rgunwaldsen)

After opening the document "Determ_FK.mcdx" in Mathcad Prime 3.1 Express and recalculation (button "Calculate") there are no errors:

24-Ruby II
(To:fstulen)

1-Newbie
(To:fstulen)

We do not know which version of Prime Foster has. Maybe he uses Express Prime and there may exist the difference between full Prime and Express Prime. If I tried to calculate the determinant of Fred's matrix B in Express Prime the result was 0.

23-Emerald I
(To:aklay)

That's interesting

and depressing.

If Express can't do an operation it should report that it can't, not give a false answer.

Can express deal with imaginary numbers?

Express lacks symbolics. And the question is: Is presence of symbolics required for calculations with complex numbers?

23-Emerald I
(To:aklay)

You don't need symbolics.  Mathcad is primarily numeric.

You should be able to open the attached file using Express.

It writes two imaginary variables and operates with them.

23-Emerald III
(To:Fred_Kohlhepp)

Express Prime does work with complex numbers,

It understands that the middle element of B is a complex number. It can produce it's complex conjugate, but the Re() and Im() functions are considered 'Premium' function, although you can easily circumvent that by defining them using the complex conjugate.

Anyway, this is what Express Prime 3.1 produces (typed everything in myself):

Luc

24-Ruby II
(To:aklay)

The following result was obtained in Mathcad Prime Express 3.0 (there is no bug). Please attach your worksheet for Prime 3.0.

1-Newbie
(To:fstulen)

I am using Prime 3.0.  I asked a colleague at work to try it.  She got the same result |A| = 0.

I ran Fred's example and it didn't work in Prime 3.0.  It did work fine in MC 15, which I downloaded via a free 30-day trial.

It is a bit more odd.  When I first opened my file in Prime 3.0 it gave the correct answer,  (Maybe it justs displayed where I left off).  Then I changed one value of variable  (a material value) of a material property and it didn't work.  When I close Prime 3.0 and then restart,  the file doesn't run even the first time.

So why does it work on Fred's Prime 3.0, and it doesn't work on others?.  Was there a patch or minor upgrade we're missing

1-Newbie
(To:fstulen)

Sorry I accidentally clicked "answered", "newbee".  I still have the problem

Emeritus
(To:fstulen)

No worries Foster - Welcome to PTC Community

Best,

Toby

23-Emerald III
(To:Tmetcalf)

So, Toby, can you (have some PTC expert) confirm that this is a bug...?

Luc

Emeritus
(To:LucMeekes)

Thanks Luc - I will make an inquiry and follow-up.

Best,

Toby

24-Ruby II
(To:LucMeekes)

Where is your worksheet with this bug, Luc?

23-Emerald III

here you go

24-Ruby II
(To:LucMeekes)

I opened your file in Prime Expres 3.1 version and click "Calculate", the result is without bugs. And what happens if you click on "Calculate"? How you include the value for "1i" in matrix element?

24-Ruby II

Now I tried to retype this example manually in the new worksheet in Prime Express 3.0, then save / resave  / recalculate worksheet, but there are no bugs.

23-Emerald III

How come you have double bars "||A||" and "||B||" for the determinant?

Luc

24-Ruby II
(To:LucMeekes)

This operator:

23-Emerald III

That should give the norm of a vector, which can be extended to the norm of a matrix ( Matrix norm - Wikipedia), but the determinant of a matrix is something different ( Determinant - Wikipedia).

Luc

23-Emerald III
(To:LucMeekes)

This is what Mathcad 11, correctly, makes of it. I'd expect mathcad 15 to give the same results:

Luc

24-Ruby II
(To:LucMeekes)

Yes, this is the "norm", for the calculation of "determinant" is used:

23-Emerald III

If I click on "Calculate" the sheet is recalculated with the same (buggy) results.

I tried playing with the calculation options. Switching on each option individually doesn't change any results, but when all are switched on:

The error messages with the two red areas are: "Unknown error: mpl%_exception".

Conclusion:

Bug!

Luc

23-Emerald III
(To:LucMeekes)

And when I subsequently unchecked each of the calculation options. Prime just crashed.

Luc

24-Ruby II
(To:LucMeekes)

Luc,