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

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

3 REPLIES 3
21-Topaz I
(To:FDS)

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

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.

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

Announcements
Top Tags