Turn on suggestions

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

Showing results for

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

Showing results for

** Community Tip** - Learn all about the Community Ranking System, a fun gamification element of the PTC Community.
X

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

Aug 22, 2020
03:51 AM

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

Aug 22, 2020
03:51 AM

Iteration

Dear all

i feel I can not do iteration x(h,i+1)=x(i)+h in Mathcad Prime

x1=2

N(h)=5/h

i(h)=1,...N(h)

x(h,i+1)=x(i)+h (Error this point)

Thank you

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Aug 22, 2020
06:51 AM

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

Aug 22, 2020
06:51 AM

Maybe you can find here something you can use (still assuming you are looking for a result vector):

P6 worksheet attached

8 REPLIES 8

Aug 22, 2020
04:05 AM

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

Aug 22, 2020
04:05 AM

You cannot define a function with one of the formal parameters being an expression.

Try

x(h, i):=x (h, i-1)+h

Success!

Luc

Aug 22, 2020
04:13 AM

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

Aug 22, 2020
04:13 AM

And also x(h, * i(h)*):=x (h, i-1)+h

Aug 22, 2020
06:16 AM

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

Aug 22, 2020
06:16 AM

Seems that you try to create a vector and are assuming ORIGIN=1.

You are using x as a function with two arguments (h,i) in one place, but then as a function of only one argument in another.

Are you looking for something like the following. If you are just interested in the last value, you can simply delete the last line (x) but of course the last value could be calculated more simply and direct.

Aug 22, 2020
06:23 AM

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

Aug 22, 2020
06:23 AM

I prefer like this

x1=2

N(h)=5/h

i(h)=1,...N(h)

x(h,i+1)=x(i)+h ( x is a function have h as a variable and i also have h as a variable)

Aug 22, 2020
06:25 AM

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

Aug 22, 2020
06:25 AM

And the answer I need *x(i+1,h) *

Aug 22, 2020
06:28 AM

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

Aug 22, 2020
06:28 AM

You can't define a function which on one instance accepts two arguments (x(h,i+1)) but on the other only one (x(i)).

Its also not clear to me what result you actually expect.

Maybe you can specify what you would like to see for h=0.4, for example.

> And the answer I need *x(i+1,h) *

You defined i as a function which returns a complete range! There is no "i+1" or "i(h)+1". You can't add a range and a number!

Still unclear what you are looking for at the end.

Aug 22, 2020
06:31 AM

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

Aug 22, 2020
06:31 AM

Ok I will test your sheets pic resulting as my expect

Thank you

Aug 22, 2020
06:51 AM

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

Aug 22, 2020
06:51 AM

Maybe you can find here something you can use (still assuming you are looking for a result vector):

P6 worksheet attached