Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

array equations ?

Status
Not open for further replies.

rb1957

Aerospace
Apr 15, 2005
15,666
A question from a pretty much non-user based on a discussion in another forum ...

want to solve Ra = (k*a)*(L-a) where L and k are scalar and "a" is an array ... and so Ra is an array

presumably Ra needs to be defined as an array ?

presumably MathCad can understand b = k*a where k is scalar and a is an array ... will MathCad say "oh, b must be an array too" or is there some syntax to tell MathCad this .. "a? what do you mean be a ? oh, you must mean for each value of a, so you mean a(i) ... humans, phht!"

or reform the expression to Ra = kLa-ka^2 ? (which seems a bit of a PITA)

"Hoffen wir mal, dass alles gut geht !"
General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.
 
Replies continue below

Recommended for you

In general, Mathcad does understand scalar multiplication with arrays, i.e., 4*a, where a is as defined in your PDF, will result in an array where each element of a has been multiplied by 4. For array multiplications, you can often get by by asking Mathcad to vectorize your expression, done by selecting your equation and doing a <CTRL>+^. That often works when I get lazy and don't, or didn't start using indices ala your PDF; it works in general, but your exact equation might have issues, so I tend to use indexed calculations, since you therefore explicitly control the calculation.

TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! faq731-376 forum1529 Entire Forum list
 
"indexed calculations" ... aka DO loops ? (that was another suggestion to the original problem.

who learnt FORTRAN ?

"Hoffen wir mal, dass alles gut geht !"
General Paulus, Nov 1942, outside Stalingrad after the launch of Operation Uranus.
 
I think the use of indices such as in the example attachment is a nice simple approach for matrix manipulation. Another aspect of its use is in the presentation of the equation itself to the reader of an analysis report. The introduction of specific software syntax or programming could start to make the process of understanding the analysis more difficult for some readers.
 
Indexed calculations is what you did in the PDF; by defining an index "i" and using it in the last equation, you essentially "programmed" a FOR loop, i.e.,

Code:
for i=0 to i=3

Ra[i=...



TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! faq731-376 forum1529 Entire Forum list
 
You’re correct, there’s many ways of doing the calculation! That’s the beauty of Mathcad!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor