Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
All the variables are defined , However I couldn't figure out why it is not working
Solved! Go to Solution.
Integration requires that you have a function defined over the entire range. You've got q defined at discrete points. You might try simple linear interpolation to define a function.
It's always better to attach the Prime worksheet, and state which version of Prime you are using.
Regarding the integration: You have a vector of values. Simply sum the vector values for the range that coincides with z going from 0 to DeltaL. You can use the summing operator for that.
Success!
Luc
Careful!
Simply summing is not the same as integration
@Fred_Kohlhepp wrote:
Careful!
Simply summing is not the same as integration
Agreed on, but not the way you had shown it.
To approximate the integral we must multiply the function values by the differences of the z-values.
In the example you gave these differences are constant 1 in, so you have to multiply the H-sum by 1 in, not by the total 4 in.
Furthermore you have to omit either the last or the first value in vector H to get the lower or upper rectangle sum.
The mean of this sum is what you get using trapezoid "integration".
trapezoid is the very same as what you should get by using linear interpolation. Adding dummy values at the end we even can get Prime to give us the result for the integral over the interpolated function.
Thank you from the bottom of my heart that was incredibly helpful