Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
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.
Solved! Go to Solution.
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..
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~
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..
Wow!!
Thank you very much Werner
See what i can to do make it even simpler.
Thanks for the replay.
You are welcome!
Jan Kowalski schrieb:
I'm simplified the function.
Fine. Whats comes to my mind now is the following: You could put the numbers you are looking for in a vector and use a for loop in which you use lookup to create another vector with either the correspunding values in K<1> or 0 if not found. This vector is then multipied by a vector consisting of the values (250000, 10000, 520, ...) to get the result for the Vector W_. Not necessarily shorter but probably easier to maintain.
Wow thanks your mind is amazing.
i'm looking for even the relationship between the vectors see atached file.
i'm looking for even the relationship between the vectors see atached file.
Hmm - your K0, K1 and K2 are not vectors but matrices. You can add matrices only if all are of the same dimension, that is, all have the same number of rows AND the same number columns. This does not work here as K0 has 4 rows while the other two matrices have only 3 rows. I am not sure what kind of addition you are heading for.
As I understand you want Mathcad to do the following addition:
I have no clue what kind of addition this should be. As already stated you can not add matrices with different dimensions. Even if I fill the necessary space with zeros, the result would differ quite a lot from what you want to achieve.
So what Math do you apply to arrive at your solution 5x2-matrix?
I think I realized what you mean. I have the feeling that it could be done much shorter and more elegant, but I can't think of a better way in the moment.
hey.
Thanks for reply.
Ok.I thought a little different,but you were able to do what I thought.
Sorry my english is poor (Google translator)
Jan Kowalski schrieb:
hey.
Thanks for reply.
Ok.I thought a little different,but you were able to do what I thought.
Sorry my english is poor (Google translator)
Glad I could help.
No need to apologize for your English. It's not my primary language either and I too have my difficulties with.