Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
I wrote and attached a basic worksheet to demonstrate what I am trying to achieve. I can get the solution by defining each part one-by-one like you will see on the attached sheet, but that is going to be too tedious on my main worksheet. A program or other built in function would be ideal.
Thanks in advance for the help.
Solved! Go to Solution.
Here are a few suggestions for functions to do the job.
On contrary to Stuart recursive function, none of them will deal with a scalar as argument and the last two fail if the argument vector has just one element. Would need to throw in an "if" to deal with that situation if necessary.
My trial period for Mathcad Prime 8 has just run out, so I can't demonstrate a programmed version, but here's a version that should run in most versions of Mathcad (this was written in Mathcad Express 7). It uses range variables.
Stuart
And here's one possible (recursive) functional solution ...
This function will return a vector even if its argument is a scalar.
Stuart
Here's one approach. Should work for any length vector >0 and with any value of ORIGIN.
Success!
Luc
Here are a few suggestions for functions to do the job.
On contrary to Stuart recursive function, none of them will deal with a scalar as argument and the last two fail if the argument vector has just one element. Would need to throw in an "if" to deal with that situation if necessary.
Thank you everyone for the help! I tried lots of different things on my end and I did not know to use the "last(v)" in there as part of the sum. That's new to me, so thank you for that as well. A couple of these solutions will work for me, and I will be able to use some of this new info on other things I will have to code later.
Andrew