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

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

Indexing

awibroe
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

See if the attached file helps!

 

View solution in original post

24 REPLIES 24

May be so

Zi.png

awibroe
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.


@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.

awibroe
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?

zi.png

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

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!

NArray.png

awibroe
14-Alexandrite
(To:ValeryOchkov)

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

That has never been possible in Mathcad.

LM_20180119_Indexing.png

 

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

 

Success!

Luc

awibroe
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

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?

Bild.png

Or

 

idx:=  0 . . last(S)

awibroe
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

See if this helps

awibroe
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.

Try this


@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

Bild1.png

or we can use the undocumented trick with the inline evaluation

Bild2.png

Liv
6-Contributor
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.

 

 

 

Fred_Kohlhepp
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:

Capture.PNG

 

 

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.

See if the attached file helps!

 

awibroe
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

 

 


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:

https://community.ptc.com/t5/PTC-Mathcad-Questions/Programming-in-PTC-Mathcad-Prime-3-0/m-p/449820#M175983

https://community.ptc.com/t5/PTC-Mathcad-Questions/Calculate-and-Communicate-with-PTC-Mathcad-Prime-3-0/m-p/449240#M176779

awibroe
14-Alexandrite
(To:Werner_E)

Thanks everyone! 

 

Also thanks for the notes on programming. I have never really tried MC15 as Prime is what I know...

Top Tags