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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Symbolic and numeric bugs on one page

ifomenko
15-Moonstone

Symbolic and numeric bugs on one page

I've met something very strange....


ScreenShort.PNG

MC15 file is attached

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:ifomenko)

Just a suggestion to avoid the confusion - overlay the function "eigenvec" by a userdefined function:

B.png

View solution in original post

7 REPLIES 7

Your problem is probably related to the fact that the symbolic eigenvalues are listed in reverse order to those of the numeric eigenvalues.

 

eigenvals.PNG

Alan

 

 

Werner_E
25-Diamond I
(To:ifomenko)

To put it short - the problem is the different results you get when you evaluate R either symbolically or numerically:

B3.png

The problem is a different handling of eigenvec in numerics and symbolics. As you possibly know the eigenvector for a given eigenvalue is not unique and numerics and symbolics chose different vectors for this. The numerics will always chose a unitvector but the symbolics doesn't.

So you get the correct result if you stay completely within symbolics

B.png

 

or if you stay completely within numerics:

B2.png

ifomenko
15-Moonstone
(To:Werner_E)

Thank you all,

I know all these specific things about the differences between symbolic and numeric calculations.

Werner, you wrote, "The numerics will always chose a unitvector but the symbolics doesn't."

For this reason, I always use eigenvec(R, lambda) function instead of simple eigenvecs(R), the first one works well and returns unit vector.

But anyway, why two last numeric calculations gave a different results?

Werner_E
25-Diamond I
(To:ifomenko)


I always use eigenvec(R, lambda) function instead of simple eigenvecs(R), the first one works well and returns unit vector.

No!! Using eigenvec instead of eigenvecs gives you control about the order of the vectors (which is also differently in numerics and symbolics as Alan had pointed out), but eigenvec WILL NOT evaluate to a unitvector symbolically:

B.png

And thats the reason for all the confusion.

You define matrix R using the function eigenval(C,lambda). Now it depends upon if you evaluate R numerically or symbolically if you get the matrix you expect, the one where the columns are unit vectors.

If you evaluate R*C.l*R^T symbolically, R gets the wrong values and you get a wrong result.

Before the last numeric evaluation you assigned R the symbolic result and so consequently the numeric R*C.l*R^T is wrong, too.

 

Werner_E
25-Diamond I
(To:ifomenko)

Just a suggestion to avoid the confusion - overlay the function "eigenvec" by a userdefined function:

B.png

ifomenko
15-Moonstone
(To:Werner_E)

Thank you very much, Werner!!!

I finally understood the problem: I always checked the norm of eigenvector numerically and got a unit. But it is not unit in symbolic case.

 

-MFra-
21-Topaz II
(To:ifomenko)

Hi,

It should be noted that the procedure is valid only for symmetric matrices.

Announcements

Top Tags