Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Anyone know how to read both the variable values (i.e. the solution) and the ERR variable generated by a parameterized solve block, short of solving the solve block twice?
Example sheet shows how you can either get the solution by calling the function <solution(parameters)=>, or the ERR variable, by calling <ERR(parameters)=>. Simply typing <ERR=> does you no good because ERR is a function.
This involves solving the equations twice, which isn't a problem until you want to run a monte carlo simulation with many data points.
Thanks,
John
Since ERR is just the sum of squared deviations, one way might be to calculate it explicitly within the solve block; then you'll get a distribution of errors along with your distribution of x's and y's.
Alan
Hi Alan,
Thanks for the reply, which does work. It doesn't quite address my problem because I don't think it saves any time in a long monte carlo simulation because there is still alot of computation- it is set up to calculate the err once for every iteration of the solver and also adding an extra variable is likely to mean more iterations.
However, the calculation of err can be carried out after the solve block using the solver solution for x and y. This way should save a pile of computation.
Thanks again, I will perhaps do all my solve blocks this way in future.
John
John Briant wrote:
...
However, the calculation of err can be carried out after the solve block using the solver solution for x and y. ...
Yes - a much more efficient way of doing it.
Alan
Thanks - very interesting work with a solve block!
If you have an interest you can see me work with solve block - Solving of algebraic equations and system or Vincent Van Gogh in Mathcad