the strangest bug I ever experienced
Peter Hinow
hinow at uwm.edu
Wed Aug 10 22:09:50 CEST 2011
Dear fellows,
can somebody please try to run the little code below? The function fff should take a 7-dimensional vector and return another 7-dimensional vector,
namely
- 0.4 - 0.3 - 0.5 - 0.28 - 0.07 - 0.07 - 0.0796 .
But what it does it returns a 9-dimensional vector
- 0.4 - 0.3 0.5 - 1. 0.72 - 1. - 0.07 - 0.07 - 0.0796
where for example -0.5 is written as "0.5 - 1". Of course then the fsolve does not work.
What could be the cause of this?
Thank you and best regards,
Peter
function y=fff(X) // X = [d1 h1 d2 h2 d3 h3 r]
y=[2*X(7) + X(1) + 2*X(3)-1, ..
4*X(7) + X(2) - 1, ..
2*X(7) + X(4) + X(6) -1, ..
4*X(7) + X(3) + X(5) -1, ..
X(1)^2+X(2)^2-4*X(7)^2, ..
X(3)^2+X(4)^2-4*X(7)^2, ..
X(5)^2+X(6)^2-4*X(7)^2];
endfunction
X = [0.1, 0.1, 0.1, 0.1, 0.02, 0.1, 0.15];
fff(X)
xx = fsolve([0.1, 0.1, 0.1, 0.1, 0.02, 0.1, 0.15],fff);
d1 = xx(1); h1 = xx(2); d2 = xx(3); h2 = xx(4);
d3 = xx(5); h3 = xx(6); r = xx(7)
--
Peter Hinow, PhD
Department of Mathematical Sciences
University of Wisconsin - Milwaukee
P.O. Box 413
Milwaukee, WI 53201-0413
USA
phone: ++1 414 229 4933
https://pantherfile.uwm.edu/hinow/www/
More information about the users
mailing list