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

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

SELECT DIFFERENT VALUES IN SUMMATION FUNCTION

ppal
17-Peridot

SELECT DIFFERENT VALUES IN SUMMATION FUNCTION

I am tring to set the starting value of the summation as below. Prime 8 file attached.

Want to be able to set k=r or k=0.

ppal_0-1668375618343.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:ppal)

Try to avoid using all uppercase letters in your subject as this is considered loud shouting/screaming and there is no reason to do so here.

 

Are you looking for a function with the argument specifying that starting value of k or do you just want to set a worksheet variable and want the calculation be done dependent on this variable.

In the latter case you may simply define a variable start to be either 0 or 1 and setup the sum to start with k=r*start.

Furthermore its not necessary to use any loop! Your for-loops just returns the last result (for j = count) and discards all the previous ones. So you may simply use count in your sum instead or r.

Werner_E_2-1668381356104.png  Werner_E_3-1668381379880.png

 

EDIT: And here is the version with a function (as before the argument "st" is either 0 or 1):

Werner_E_4-1668381683921.png

 

 

Additional remark/question:

Why do you setup these as functions in t? None of them is dependent on t!!! The result is the same vector no matter which function argument you provide when you call these functions. So they could as well be variables instead of functions.

Werner_E_5-1668382022514.png

 

 

View solution in original post

1 REPLY 1
Werner_E
24-Ruby V
(To:ppal)

Try to avoid using all uppercase letters in your subject as this is considered loud shouting/screaming and there is no reason to do so here.

 

Are you looking for a function with the argument specifying that starting value of k or do you just want to set a worksheet variable and want the calculation be done dependent on this variable.

In the latter case you may simply define a variable start to be either 0 or 1 and setup the sum to start with k=r*start.

Furthermore its not necessary to use any loop! Your for-loops just returns the last result (for j = count) and discards all the previous ones. So you may simply use count in your sum instead or r.

Werner_E_2-1668381356104.png  Werner_E_3-1668381379880.png

 

EDIT: And here is the version with a function (as before the argument "st" is either 0 or 1):

Werner_E_4-1668381683921.png

 

 

Additional remark/question:

Why do you setup these as functions in t? None of them is dependent on t!!! The result is the same vector no matter which function argument you provide when you call these functions. So they could as well be variables instead of functions.

Werner_E_5-1668382022514.png

 

 

Top Tags