Skip to main content
1-Visitor
January 3, 2013
Solved

How to sum ​​up the results?

  • January 3, 2013
  • 2 replies
  • 4222 views

hi . . my name is Jan

i know very litle about programing. still learning from tutorials. u can call me a beginner.

now i need to sum results

Could anyone help, please.

The attached file is an explanation of everything.

I'm using Mathcad 15.

Best answer by Werner_E

1) You did not cycle from 0..N but simply calculated W for N=2. That way W only gets the value for N=2 ((18))

Solution: Write a prog which cycles from 0 to N calculates the values and append them to the vector W

2) Even then you could not use the sum symbol you tried as this only sums up vectors consisting of numbers. What your calculation of W produces is a nested vector.

Solution: change all calls to "pick(......)" to "pick(.....)[0" and you get a vector of the numbers you want which you can sum as you had tried.

comment: I think whatever you sheet should do could possibly be done less complicated. At least on first sight it looks like the combinaton of "match" and "pick" could be replaced by a simple use "lookup" - but then I may be wrong, so give it a try..

helpsum1.png

2 replies

3-Newcomer
January 3, 2013

I didn't try to figure out what your program is doing, but you are on the right track. The variable W is a single value = 18, and if you sum that, you get 18.

It looks to me as if W will only return a single value.

~R~

Werner_E25-Diamond IAnswer
25-Diamond I
January 3, 2013

1) You did not cycle from 0..N but simply calculated W for N=2. That way W only gets the value for N=2 ((18))

Solution: Write a prog which cycles from 0 to N calculates the values and append them to the vector W

2) Even then you could not use the sum symbol you tried as this only sums up vectors consisting of numbers. What your calculation of W produces is a nested vector.

Solution: change all calls to "pick(......)" to "pick(.....)[0" and you get a vector of the numbers you want which you can sum as you had tried.

comment: I think whatever you sheet should do could possibly be done less complicated. At least on first sight it looks like the combinaton of "match" and "pick" could be replaced by a simple use "lookup" - but then I may be wrong, so give it a try..

helpsum1.png

jkowalski1-VisitorAuthor
1-Visitor
January 3, 2013

Wow!!

Thank you very much Werner

See what i can to do make it even simpler.

Thanks for the replay.

25-Diamond I
January 3, 2013

You are welcome!