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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Solving equations using using arrays

swahlgren
1-Newbie

Solving equations using using arrays

The attached contains an expression I wish to use in a solver to determine x-amount of constants (the Q's) from a system of an equal amount of equations and unknowns (the constants). The problem in mathcad arises when I'm using multiple (two) arrays within the solve block.

ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:swahlgren)

As already suggested, get rid of the summation and the indexing.

View solution in original post

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

You will have to specify a value for n first.

You will also have to provide at least a sample for the vector u and the square matrix lamda.Q so we have soemthing to play with.

Werner_E
25-Diamond I
(To:swahlgren)

Can it be that you are looking for something like the attached?

EDIT: Of course you can get the result much easier using the inverse:

1.png

Something like that but I need to include summation over one of the indices.

Untitled.png

"Funny" thing is I got it working a few minutes ago but the Mathcad shut down spontaneously and I can't get it working again. The error message is:"This variable is undefined"

Werner_E
25-Diamond I
(To:swahlgren)

What you set up with your sum is exactly the multiplication of the matrix lamda.Q with the vector Q - thats the reason I posted my sheet in the last message.

The error messages in solve blocks are misleading - you will always get that "undefined variable", no matter what the real cause is. Right klick at the error message and chose "Trace Error" to get at least a message which may be a bit more useful.

I've entered exactly what you you did in the attached but I still get that same error. It can be traced to the "i" index that supposedly has to be an integer.

MikeArmstrong
5-Regular Member
(To:swahlgren)

Please post your worksheet.

Capture.PNG

MikeArmstrong
5-Regular Member
(To:swahlgren)

Please post the actual worksheet an image is no good in this instance.

here

RichardJ
19-Tanzanite
(To:swahlgren)

As already suggested, get rid of the summation and the indexing.

You're absolutely right and it works perfectly now. I initially dismissed it as being too simple to be correct but I guess I need to brush up on my matrix multiplication rules. Thank you so much!

Everything up until the graph goes in to creating the lambda_Q and u_3Q matricess for a known Q matrix. The solve block is an attempt at solving the inversed problem where lambda and u are known and Q is sought.

MikeArmstrong
5-Regular Member
(To:swahlgren)

I have managed to return results but I am not sure if it is what you are after.

Announcements

Top Tags