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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Indexing functions

FDS
12-Amethyst
12-Amethyst

Indexing functions

First of all a happy prosperous and especially healthy 2019 to all! I have apparently a misunderstanding when to use indexing versus vectorisation. In the attached worksheet indexing works but vectorisation doesn't. Could someone help me out with this because I seem to be lost.

Best regards, Filip

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:FDS)

When doing calculations where you later want to fill in vectors of data I would strongly recommend to set up all those calculations as functions dealing with scalars only and later call those functions vectorized with the data vectors as arguments.

See attached worksheet.

 

View solution in original post

3 REPLIES 3

Hi,

 

In the first instance of indexing, f(p,i) returns a single value at any point p and thus can be numerically integrated with respect to "p".


In the second instance of vectorisation, f(p) returns a vector as the result. "p" as an input can be either a single value or a vector of similar size to PA50. It is not possible to numerically integrate a function that returns a vector at every point. The integration thus fails.

 

Cheers

Terry

 

 

Werner_E
24-Ruby V
(To:FDS)

When doing calculations where you later want to fill in vectors of data I would strongly recommend to set up all those calculations as functions dealing with scalars only and later call those functions vectorized with the data vectors as arguments.

See attached worksheet.

 

FDS
12-Amethyst
12-Amethyst
(To:Werner_E)

Terry, thank you so much for the clarification as this explains the why.

Werner, thank you for your additional hint. It is indeed a much clearer way to do it the way you propose. I will try to use this not only for this worksheet but also for future ones.

All the best, Filip

 

Top Tags