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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Solve non-trivial solution to a Matrix Function other than the solve block

sfan
1-Visitor

Solve non-trivial solution to a Matrix Function other than the solve block

Hi, everyone,

Capture.JPG

Right now I just want to find the non-trivial solution to the last equation above,

I can find that using the solve block, but since solve block cannot be used in programming,

I am afraid I have to find another way to solve a Matrix function with non trivial solution.

In Matlab, [eigenval, eigenvecs] = eig (K, M) would return to EV as eigenvecs, using the equation M*EV*lambda = K*EV, and it is easier for programming, say K & M varies.

So is there a way to solve non-trivial solution to a Matrix Function other than the solve block in Mathcad?

Thank you for your help!

Best

Shawn

ACCEPTED SOLUTION

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

In Matlab, [eigenval, eigenvecs] = eig (K, M) can return to both lambda and corresponding EVs, but not sure how to achieve it in Mathcad.

Would this help:

View solution in original post

13 REPLIES 13
Werner_E
25-Diamond I
(To:sfan)

Have you tried "solve, fully" ?

But as long as you don't tell Mathcad that EV should be a vector or matrix, you will just get 0 as solution as this is the only solution of this equation - Mathcad treats EV as a scalar.

sfan
1-Visitor
(To:Werner_E)

I tried "solve, fully", but did not work as well.

So is there a way to solve Matrix equation, without using Solve Block?

I just want to make some preparation for the future programming work, if there is.

In this problem, lambda matrix is the eigenvalues of D=K-lambda*M,

then, using the Eigenvecs cannot come out with the right EV.

That's why I use this equation M*EV*lambda = K*EV to find EV.

In Matlab, [eigenval, eigenvecs] = eig (K, M) can return to both lambda and corresponding EVs, but not sure how to achieve it in Mathcad.

RichardJ
19-Tanzanite
(To:sfan)

You can't put a solve block in a program, but you can turn a solve block into a function:

phi(K,M):=Find(EV)

Then you can call phi(K,M) in a program with different K and M,

sfan
1-Visitor
(To:RichardJ)

Hi, Richard,

Could you help me with some detail?

I tried to use the syntax in Solve Block, and defined a function, however, find function said "the function is misplaced. Move it to a solve block with one solve block function only.'

2015-11-22.png

Anything to modify here?

Best

Shawn

RichardJ
19-Tanzanite
(To:sfan)

This is what I meant:

There are two solve blocks, in cyan and yellow, that have been created as function definitions. The layout in Prime is a little different, but it works the same way. Once the functions have been defined they can be called anywhere later in the worksheet, including in programs. Note the use of symbolic evaluation of the first function to find all the eigenvalues, not just the one nearest to a guess value.

I don't suggest this is the optimal way to find eigenvalues and eigenvectors, but it shows what I meant.

sfan
1-Visitor
(To:RichardJ)

Hi, Richard

But how to present the given and find block in Prime?

I tried both way, one is the syntax in 15 and the other is the solve block in prime.

Both shows the function Evals(K,M) cannot return to lambda

Capture.JPG

Best

Shawn

RichardJ
19-Tanzanite
(To:sfan)

In Prime the correct form is the one on the right. Solve blocks can't just be typed into the worksheet (IMO a very annoying "feature" of Prime). But.....

I would call that a bug. It seems that in Prime the symbolic engine doesn't know what to so with a function that's defined in a solve block.

RichardJ
19-Tanzanite
(To:RichardJ)

This works, as long as lambda is either not defined prior to the function definition, or you use clear.sym(lambda) immediately before the function definition if it is defined.

sfan
1-Visitor
(To:RichardJ)

Yeah! It works, and for the eigenvector, use the solve block will produce a valid solution this time.

Capture.JPG

Thank you so much, Richard,

I really learn a lot from your teaching!

Would mark both yours and Werner's as the correct answer.

May the force be with you two!

Best Regard

Shawn

RichardJ
19-Tanzanite
(To:sfan)

I really learn a lot from your teaching!

Glad I can help

FYI, In Prime that equation can be written in a simpler and more intuitive way. MC15 only has a column operator, so to getting a row requires a transpose, then the column operator, then another transpose. In Prime it just requires the row operator:

sfan
1-Visitor
(To:RichardJ)

Oh, right, I just find that operator.

It is more convenient.

Thank you!

Werner_E
25-Diamond I
(To:sfan)

In Matlab, [eigenval, eigenvecs] = eig (K, M) can return to both lambda and corresponding EVs, but not sure how to achieve it in Mathcad.

Would this help:

sfan
1-Visitor
(To:Werner_E)

You are my hero!

Announcements

Top Tags