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

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

Indexing functions

DJF
16-Pearl
16-Pearl

Indexing functions

Is there any way to index functions so that I can call different functions through an indexed variable (i)?  Something like this - although this only works as shown. When I try to turn x into a function (e.g. x as a function of t)) Mathcad balks and won't even let me define it (doesn't understand the syntax or refuses to let me define :=) 

 2018-01-10_14-24-10.jpg 

4.0 attached.  Thanks!

ACCEPTED SOLUTION

Accepted Solutions
DJF
16-Pearl
16-Pearl
(To:LucMeekes)

Thanks Luc,

Does exactly what I asked for - so A+ for that.  My actual sheet requires a bit of modification along these lines - really just having to do with how I want my functions arranged.  

2018-01-10_19-14-39.jpg

 

I guess I'll find out, but when I call x(t)_0 is it going to solve  R1 and R2?  That would really bog it down on a big sheet.

 

 

I also toyed with concat to create a function name like "x1", "x2" that I could call, but once something is a string I can't seem to do anything with it.  But that would be slick if it worked.

Thanks,

View solution in original post

4 REPLIES 4
LucMeekes
23-Emerald III
(To:DJF)

Something like this?

LM_20180110_Function.png

Success!
Luc

DJF
16-Pearl
16-Pearl
(To:LucMeekes)

Thanks Luc,

Does exactly what I asked for - so A+ for that.  My actual sheet requires a bit of modification along these lines - really just having to do with how I want my functions arranged.  

2018-01-10_19-14-39.jpg

 

I guess I'll find out, but when I call x(t)_0 is it going to solve  R1 and R2?  That would really bog it down on a big sheet.

 

 

I also toyed with concat to create a function name like "x1", "x2" that I could call, but once something is a string I can't seem to do anything with it.  But that would be slick if it worked.

Thanks,

DJF
16-Pearl
16-Pearl
(To:DJF)

Ok, Luc's idea worked.  (Success!)  It solved almost instantly so I think it was solving only what it needed to.  Anyway, here's a final formulation (piecewise cam profile with 20 unique regions.  The RegionX calculations house the equations for R, V, A, J, S for that region).  Yet another handy trick to know.  

 

2018-01-10_20-31-50.jpg

 

 

Werner_E
25-Diamond I
(To:DJF)


@DJF wrote:

It solved almost instantly so I think it was solving only what it needed to.


No, it evaluates all 21 functions and only then selects the one result you demand by the index.

Bild.PNG

Announcements

Top Tags