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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Iterative loop with symbols

AndreyK
1-Newbie

Iterative loop with symbols

Hello,

Can you please tell me how can I implement the attached code as a loop in Mathcad?

The values of ci are computed in an iterative way, and I need to store them all (as a vector of functions for example), so that each ci is a function.

Thanks,

Andrey

8 REPLIES 8
MikeArmstrong
5-Regular Member
(To:AndreyK)

Firstly you don't need to define a(x):x.


Have you defined c.3?

Clipboard01.jpg

Mike

Hi Mike,

I'm not sure I understand your answer.

The code that I attached to the original question is just an example, a(x) has no particular meaning.

I defined c.3, and c.4.

I'm willing to be able to calculate c.5, c.6 and so forth - say till c.50, but not manually. How can I do it in a loop?

Andrey K wrote:

Hi Mike,

I'm not sure I understand your answer.

The code that I attached to the original question is just an example, a(x) has no particular meaning.

If this is merely anexample, then I don't know how to do this generically.

For this specific case,we can develop a solution by inspection, but I don't know if you could extend the solution to a general case. That would take more mathematican than I.

Mr. kohlhepp (don't know first name, so sorry for the formality)

Please look at my modification, wherein the function names a (or A) and b (or B) are in the argument list of the program and not in the program itself, I can change the functions a and b without modification of the program. I think this is what Andrey is looking for.

Thanks,

Wayne

Wayne Reid wrote:

Mr. kohlhepp (don't know first name, so sorry for the formality)

Please look at my modification, wherein the function names a (or A) and b (or B) are in the argument list of the program and not in the program itself, I can change the functions a and b without modification of the program. I think this is what Andrey is looking for.

Thanks,

Wayne

Wayne;

I saw what you did--very impressive. Then I tried to evaluate the 50th function. I got tired of waiting and interrupted the calculation.Plus, the request was for a symbolic solution.When I tried to evoke a symbolic answer from your methodI could not.

You are, however, correct; your method will rigorously work for whatever functions are inserted as long as they can be numerically integrated. My method is not proven, just an observation for this specific case.

Fred

Thanks Fred,

I know symboics was in the title, but then he talks about numerical evalutaion.

Regarding length of time, the number of integrations required for the 50th one is staggering. If the functions a and b are fixed, pursuing (as far as possible) as you porpose is a good idea.

Wayne

wayne
3-Visitor
(To:AndreyK)

Andrey,

I gave it a try, see if this works.

Wayne

AndreyK
1-Newbie
(To:wayne)

Hello guys,

Thank you very much for your suggestions.

I asked this question because I wanted to understand what is the right method for addressing such problems (iretative symbolic calculations) in Mathcad.

I'm new to Mathcad and I thought that when running in a loop, the calculation can use the result of the previous iteration. Now I realize that every calculation in Mathcad is performed separately, even in loops. Am I right?

If so, Mathcad is probably not the tool I'm looking for.

Again, thank you all very much,

Andrey

Top Tags