Skip to main content
1-Visitor
March 7, 2013
Question

Comparing Two RV Arrays and Outputting Character Strings

  • March 7, 2013
  • 11 replies
  • 6329 views

So I'm very new to mathcad prime and I'm trying to compare resultant numbers from computing with range variables. I was hoping someone could show me how to figure out what I'm trying to accomplish.

Example (simplified):

I've defined two range variables

A:=220,320..420

B:=840,640...440

then applying some math with the RVs

C(A):=A/2

D(B):=B/4

I would then like to compare the first value of C to the three values in D and determine if it is greater than or less then the D value and then output an array with Yes if greater, or No is less than. Then repeat this with the second and third values in C respectively.

I'm thing something like this...

i=0

j=0

for i=1:3

for j=1:3

if C(i)>D(j)

E(i+j) = "Yes" %I'd like the ouput to be a one dimensional array/vector and not a two dimensional matrix

else

E(i+j) = "No"

end

end

The red boxes are the two variables I'd like to compare, and display if alpha is greater than tau in a coulmn matrix/array.

Untitled.png

11 replies

19-Tanzanite
March 7, 2013

The attached should help. Be careful to learn the difference between range variables and "proper" variables.

Alan

1-Visitor
March 7, 2013

Would you be so kind as to briefly describe the difference?

19-Tanzanite
March 7, 2013

See the attached articles by Stuart Bruff.