Can someone help me with this loop? I cannot seem to get the loop working for the for statement
Solved! Go to Solution.
What exactly do you want the program to return? You pass i as a parameter to the program (i.e the program is a function definition), but i is defined as a loop variable, which overwrites any value of i passed as a parameter. In each if statement you have a local function definition (i.e. local to the program), and outside the loop you have two more local function definitions. A function definition does not create any numerical values though, it just defines the function. Do you want to return the values of alpha (case 1) or I (case 2) for all the values of i (this is what I suspect you want) or do you want to return one or more function names (which is possible, but since you have to ask this question, I suspect is not what you want).
Richard, thanks for the response.
I am trying to evaluate the moment of inertia along the length of a column, which is divided into 8 elements. I have derived two expression for the diameter if:-
1. The first half of the column 0<x<l/2
2. The second half of the column l/2<x<l
I am trying the find the I value at each node, and then plot a graph along the length of the column for various values of alpha
Good day Ramani,
Looks like Fred Kohlhepp has you up and running (thanks Fred); if so, would you please mark his answer as correct so we know you are all set?