Klaynos Posted September 11, 2006 Posted September 11, 2006 I'm a tiny bit desperate on this one... I am trying to debug a small piece of code I've written. I have a procedure for solving some quite complex equations. For single points in space. I have a procedure that: has some quantities passed to it, brings in a 2 by 80 Does a for loop for each of the rows in the data, to take the first col value, and puts that along with the vars passed to it into the first procedure. It then works out the difference between the value given by the first procedure and the second col. Squares this and adds it to the total. I'd like to use the NPLSolve minimize function to minimise this total squared sum of differences, by passing differnt values to the second function. Unfortunatly this seems to fail. When I try to print out the values passed to the second proc I get just the names. eg. (note not my real code) proc1:=proc(a,b,c,d) <some equation stuff> end proc proc2(a,b,c) matrix:=LOAD MATRIX for j is length of matrix d=matrix[1,j]; temp1:=proc1(a,b,c,d) dif:=dif+(temp1-b)^2 end for return dif end proc Optimization[NLPSolve](proc2(a,b,c), a=50E-9..100E-9,b=100E-9..150E-9,c=50..100) This just takes forever, and putting print(a,b,c) into proc2 prints just "a,b,c" not any numbers.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now