I know secantRoot needs to be cleaned up and probably moved to Utilities if it's useful. For some reason, I thought it was a good idea to pull this out into a function that takes a lambda about an hour and a half ago. Feedback still useful and requested!
Looking for your opinion on the best approach for defining functions which need root finding. Ran into a problem where the functions I want to find the roots for mathematically are of one variable, x, but have additional input parameters used as constants in the equation. These values either need to be passed in as input parameters, or put into the state of the object so they can just be accessed, or instead we can define the function as a lambda inside another function and use the closure to capture the constant values needed. I put a (rough) example of this in the function that calls secantRoot as an example for discussion. I'm not sure I like this, but it's the only way that made consistent sense to me. Let me know what you think.
You'll also notice a lot of "how to fail"? messages in here. Is there a standard way in CSM to fail?
Also, there are a lot of placeholders for "accessing values from the ISD" because I wasn't sure which of these you were working on. These obviously need to be updated.
Notable:
I know secantRoot needs to be cleaned up and probably moved to Utilities if it's useful. For some reason, I thought it was a good idea to pull this out into a function that takes a lambda about an hour and a half ago. Feedback still useful and requested!
Looking for your opinion on the best approach for defining functions which need root finding. Ran into a problem where the functions I want to find the roots for mathematically are of one variable, x, but have additional input parameters used as constants in the equation. These values either need to be passed in as input parameters, or put into the state of the object so they can just be accessed, or instead we can define the function as a lambda inside another function and use the closure to capture the constant values needed. I put a (rough) example of this in the function that calls
secantRoot
as an example for discussion. I'm not sure I like this, but it's the only way that made consistent sense to me. Let me know what you think.You'll also notice a lot of "how to fail"? messages in here. Is there a standard way in CSM to fail?
Also, there are a lot of placeholders for "accessing values from the ISD" because I wasn't sure which of these you were working on. These obviously need to be updated.