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

SOLVED
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.

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

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

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

Hmmmm!

From my 3.0:

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

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!

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

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

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

Please provide a worksheet (and screenshot) of your issue.

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

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.

Sapphire III
(in response to aklay)

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

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?

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

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

Sapphire III
(in response to aklay)

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

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.

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

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

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

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

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

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

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

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

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

No worries Foster - Welcome to PTC Community

Best,

Toby

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

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

Luc

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

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

Best,

Toby

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

Where is your worksheet with this bug, Luc?

here you go

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

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?

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

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.

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

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

Luc

This operator:

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

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

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

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

Luc

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

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

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

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

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

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

Luc

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

Luc,

From what source did you get your Mathcad Prime Express version?