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

Undefined Variable Help

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

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Undefined Variable Help

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.

3 REPLIES 3

Re: Undefined Variable Help

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.

Re: Undefined Variable Help

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

Re: Undefined Variable Help

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