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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

1-Newbie

## Using results from output of function

See screen grab attached.
I'm not that hot on mathcad so excuse the lack of termiknowledge.

Essentially I've created a function which outputs a 'list' of values I then go on to change the input values producing new 'lists'.

I would then like to evaluate the first value of each list against the others, however, I believe the 'lists' need to be any of; an array, a vector or a matrix. Which I'm assuming they're not going by B[1]= failing to return a value.

My attempts to convert them have failed: (units are not compatible)
As you can see at the moment I've just typed out the first value of the 'list'.
Any help is appreciated.

Cheers,
J

1 ACCEPTED SOLUTION

Accepted Solutions
1-Newbie
(To:JL_10781440)

Ok so I've found that if I define my original range as equal to a new variable it becomes a vector or array. This then means my output becomes a vector/array I can then pull values from it.

Which if you ask me is stupid all I'm doing is typing z:=x and z is now a vector/array where x wasn't.

5 REPLIES 5
23-Emerald III
(To:JL_10781440)

Further: You need to understand the difference between a range and a vector.

You've created z as a range. And while the result of B(z) looks like a vector, it is not, so you cannot index it.

Success!
Luc

For some info on range <> vector see here: https://community.ptc.com/t5/Mathcad/How-to-form-a-matrix-with-variables-defined-with-range/m-p/891020#M207928

1-Newbie
(To:LucMeekes)

Hi Luc

As shown in my own reply all I needed to do was redefine my z range as any other variable and all was gravy.

23-Emerald III
(To:JL_10781440)

Yep, gravy.

But bear in mind that you are now using an undocumented trick. It may become supported functionality, or become non-functional in a future version of Prime.

Success!
Luc

1-Newbie
(To:JL_10781440)

Ok so I've found that if I define my original range as equal to a new variable it becomes a vector or array. This then means my output becomes a vector/array I can then pull values from it.

Which if you ask me is stupid all I'm doing is typing z:=x and z is now a vector/array where x wasn't.

24-Ruby V
(To:JL_10781440)

The (undocumented) trick to turn a range (which is kind of an implicit loop and not a set of values)  into a vector is not the re-assignment to another variable but the inline evaluation immediately after the definition in the same region. If you would defined x:=0,R/10..R = then x would have been a vector right away.

The trick exists for a very long time (even back in older versions of real Mathcad) but as its undocumented its a matter to be changed without notice. So while its quite convenient, it may be a good idea not to rely on it in important worksheets which are supposed to have a long life span.

Announcements
Top Tags