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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

14-Alexandrite

## Indexing

Hi,

I am using MC Prime 3. I am trying to see if it is possible to interpret various points using indexes as per the attached.

Basically I have defined various matrixes and interpreted lines between them as a function of z. Then I have used solve blocks to find the z value when the two lines interpreted from my matrixes meet. However, as I am doing many iterations of the same thing I want to know if it is possible using indexes or if there is a better approach? I have never got into MC Programming but guess that might be an approach?

Thanks,

Andy.

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:awibroe)

See if the attached file helps!

24 REPLIES 24
24-Ruby III
(To:awibroe)

May be so

14-Alexandrite
(To:ValeryOchkov)

Hi Valery,

That is really interesting! I think that solves my initial problem. as outline. Could you take this a step further. Where I want to interpolate ST with the WL values but I have multiple sets of WL as the attached.

Cheers,

Andy.

24-Ruby III
(To:awibroe)

@awibroe wrote:

Hi Valery,

That is really interesting! I think that solves my initial problem. as outline. Could you take this a step further. Where I want to interpolate ST with the WL values but I have multiple sets of WL as the attached.

Cheers,

Andy.

In Prime 4 all ok. In Prime 3.1 I have your error.

14-Alexandrite
(To:ValeryOchkov)

Can you show me a screen shot of what you are doing to get the second problem? i.e. multiple sets of WL?

24-Ruby III
(To:awibroe)

14-Alexandrite
(To:ValeryOchkov)

Hi,

Yes I got that working OK. Just looking at the further problem in the attached introducing the same loginc but to two sets of indexes i.e. "I" for the existing problem but adding "ii" to get two sets of WL plots to intersect ST.

Attached.

Thanks,

Andy

24-Ruby III
(To:awibroe)

I think it is not a bug but a ??? in Mathcad. We can not so work with a Nested Array. Only with a vector or a matrix!

14-Alexandrite
(To:ValeryOchkov)
Do you have any thoughts on how this could be applied to my problem?
23-Emerald III
(To:ValeryOchkov)

That has never been possible in Mathcad.

It's a lack of ...support for multidimensional arrays/matrices... in Mathcad.

Success!

Luc

14-Alexandrite
(To:LucMeekes)

Hi Luc,

So in the context of my problem, I think the attached is the closest to what I want? i.e. I will still have to manually write out each variable of t?

A

24-Ruby V
(To:awibroe)

I am not really sure what you are trying and I don't know  why all your S[i seem to be the very same. I also wonder if tha adding of 0.001 or 0.0001 here and there was done on purpose or if it was done just to avoid an error when using linterp. It looks like you just want to cut a vertical with a horizontal?

Anyway - could it be that you are just looking for something like the following?

23-Emerald I
(To:Werner_E)

Or

idx:=  0 . . last(S)

14-Alexandrite
(To:Fred_Kohlhepp)
Hi all,

What I’ve sent is a very simplified version of a bigger problem to make it easier to explain. Yes the S values here are the same but are not in my actual problem. The addition of 0.0001 I’d to avoid an error in interpolation. What I want to do is automate as far as possible, finding points of intersection between two lines S and W. However There is a differing W for each S. Then there are sets of W. So in set one there will be a series of points of intersection for set W0 and the various Ss, then for second set of Ws there will be a series of points of intersection and so on.

A
23-Emerald I
(To:awibroe)

See if this helps

14-Alexandrite
(To:Fred_Kohlhepp)

Just trying to get my head around what is going on here Fred.

I have tried to better explain what I am after in the attached.

23-Emerald I
(To:awibroe)

Try this

24-Ruby V
(To:Fred_Kohlhepp)

@Fred_Kohlhepp wrote:

Or

idx:=  0 . . last(S)

No. A range won't work OK as you can't access the result. You can't assign the output to a variable.

So idx has to be a vector.

But of course we do not have to resort to a program to create it.

We could use an auxiliary range

or we can use the undocumented trick with the inline evaluation

6-Contributor
(To:Werner_E)

Undocumented :  entirely true, for Mcd15 too.

So, same behavior in Mcd15. Just placing an inline = after the definition of a range variable makes it no more usable for working with, e.g. for retrieving elements of vectors and operate with them in the subsequent part of the worksheet.

That seems to me not being consistent with the usage of the inline = with other type of variables, since in the case of range variables it completely changes their significance.

Just putting an inline = after such definition made the rest of my worksheet of about 30 pages full of errors and to spend one hour to (re)discover the reason why. I initially thought  that's a kind of a bug, but it appears it isn't....

Therefore, users, take care with this inline = with indexes !

Regards, Liv.

23-Emerald I
(To:Liv)

I don't think Mathsoft ever intended us to put an in-line equals after a range variable.  (I'm not sure when the in-line equals became possible.)  I'm a  little surprised it doesn't throw an immediate error after a range variable.

Think of it as "Here's an in-line equal.  They must mean they wanted a vector, not a range variable. . ."  And, since it got converted to a vector, unless you index it you are referring to the whole thing, so if it's positioned as an index Mathcad can't figure out which element of the vector you wanted.

There are very few times an in-line equal is worthwhile.  I think it got added so that you could format answers the way professors wanted you to:

24-Ruby V
(To:Fred_Kohlhepp)

Another use for the inline evaluation is to stop the symbolics to backtrack the exact origin of the definition of a variable which was derived by a method which is only available for numeric evaluation. So we are able to use those numerically derived variable values in symbolic calculations.

We had a few examples for this here in the forum the last months.

24-Ruby V
(To:awibroe)

See if the attached file helps!

14-Alexandrite
(To:Werner_E)

Thanks guys,

Many possibilities. I will look through these at the weekend.

I also feel like it is about time I start dabbling in programmes. Any advice on where to start? Are the standard help files any good at learning programming in MC?

Cheers,

A

24-Ruby V
(To:awibroe)

awibroe wrote:

I also feel like it is about time I start dabbling in programmes. Any advice on where to start? Are the standard help files any good at learning programming in MC?

Most what I know about Mathcad I learned from the help and from this forum (and of course by trial and error). But it was a better help (Mathcad 15 and below) and a better forum (the good old Mathcad collab).

Even though the help in Prime was simply converted from Mathcad 15 in great parts, I find the look and feel mediocre and navigation cumbersome. But just give it a try and if you get stuck come here and ask.

I still use Mathcad 15 as I find it much superior and powerful compared to Prime  ans mainly use Prime only for answering questions here. So maybe you find the help in Prime helful anyway.

I just found some older Prime sheets from PTC which should still open with Prime 3.0. Note sure if they are useful - give it a try ad judge yourself: