Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Indexing functions

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-02-2019
07:04 AM

01-02-2019
07:04 AM

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

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-02-2019
10:19 AM

01-02-2019
10:19 AM

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

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-02-2019
08:37 AM

01-02-2019
08:37 AM

Re: Indexing functions

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

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-02-2019
10:19 AM

01-02-2019
10:19 AM

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.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-02-2019
10:50 AM

01-02-2019
10:50 AM

Re: Indexing functions

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