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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Undefined Variable Help

ptc-6805698
1-Newbie

Undefined Variable Help

I've just started using MathCad, and I do not know why the Resultants1 variable is undefined (its probably some silly error, but its been frustrating me for a while now).

Any help would be immensly appreciated.

Thanks in advance all!

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:ptc-6805698)

Calculations in a Mathcad worksheet are carried out from top left to bottom right, in the same way you would read a page of text. Your use of lsolve is above the definition of Resultants, so it sees the variable as undefined. Move it down, and the error goes away. You do then get another error, because you have 15 rows in Resultants, but only 14 rows in Coefficients. If you delete one row from Resultants it works.

View solution in original post

3 REPLIES 3
RichardJ
19-Tanzanite
(To:ptc-6805698)

Calculations in a Mathcad worksheet are carried out from top left to bottom right, in the same way you would read a page of text. Your use of lsolve is above the definition of Resultants, so it sees the variable as undefined. Move it down, and the error goes away. You do then get another error, because you have 15 rows in Resultants, but only 14 rows in Coefficients. If you delete one row from Resultants it works.

Two problems.

1. Mathcad evaluates a worksheet from left-to-right and then top-to-bottom. Normally, all variables must be defined before they are used (symbolic processing is a different matter). So you need to define the lsolve equation after defining Resultants (ie, either to the right and/or below Resultants).

2. lsolve solves the equation M*x=v. Hence M and v must have the same number of rows. Coefficients (M) has 14 rows whereas Resultants (v) has 15. You need to correct your equation (I've demonstrated this by taking the transpose of Coefficients in the attached worksheet).

Mathcad error messages can be particularly unhelpful and sometimes need a bit of interpretation.

Stuart

Great! That solved my problems. Thanks a lot everyone!

Top Tags