Solving nonlinear equations with mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg35272] Solving nonlinear equations with mathematica
- From: Sebastian Pokutta <sebastian at pokutta.de>
- Date: Fri, 5 Jul 2002 02:21:41 -0400 (EDT)
- Organization: University of Essen, Germany
- Sender: owner-wri-mathgroup at wolfram.com
Hi together, I try to solve a system of 9 nonlinear Equations of the following forms: Sum[(1/Sqrt[( S[[i, 1]] - X_j)^2 + ( S[[i, 2]] - Y_j)^2])*S[[i, 3]], {i, 1, 3}] = Z_j ( 1 <= j <= 9 ) I tried this with "findroot" and 9 Points (X_j,Y_j,Z_j) ( 1 <= j <= 9 ) searching the S[[i,k]] ( a 3 x 3 matrix ) in the following way: X = {{127, 17, 5.0316}, {118, 54, 1.9392}, {5, 10, 1.60571}, {67, 54, 1.04543}, {7, 15, 1.19647}, {24, 11, 1.10665}, {17, 21, 1.85287}, {31, 18, 1.59878}, {35, 7, 1.10325}}; FindRoot[{(1/Sqrt[(s11 - X[[1, 1]])^2 + (s12 - X[[1, 2]])^2])* s13 + (1/Sqrt[(s21 - X[[1, 1]])^2 + (s22 - X[[1, 2]])^2])* s23 + (1/Sqrt[(s31 - X[[1, 1]])^2 + (s32 - X[[1, 2]])^2])*s33 - X[[1, 3]] == 0, (1/Sqrt[(s11 - X[[2, 1]])^2 + (s12 - X[[2, 2]])^2])* s13 + (1/Sqrt[(s21 - X[[2, 1]])^2 + (s22 - X[[2, 2]])^2])* s23 + (1/Sqrt[(s31 - X[[2, 1]])^2 + (s32 - X[[2, 2]])^2])*s33 - X[[2, 3]] == 0, (1/Sqrt[(s11 - X[[3, 1]])^2 + (s12 - X[[3, 2]])^2])* s13 + (1/Sqrt[(s21 - X[[3, 1]])^2 + (s22 - X[[3, 2]])^2])* s23 + (1/Sqrt[(s31 - X[[3, 1]])^2 + (s32 - X[[3, 2]])^2])*s33 - X[[3, 3]] == 0, (1/Sqrt[(s11 - X[[4, 1]])^2 + (s12 - X[[4, 2]])^2])* s13 + (1/Sqrt[(s21 - X[[4, 1]])^2 + (s22 - X[[4, 2]])^2])* s23 + (1/Sqrt[(s31 - X[[4, 1]])^2 + (s32 - X[[4, 2]])^2])*s33 - X[[4, 3]] == 0, (1/Sqrt[(s11 - X[[5, 1]])^2 + (s12 - X[[5, 2]])^2])* s13 + (1/Sqrt[(s21 - X[[5, 1]])^2 + (s22 - X[[5, 2]])^2])* s23 + (1/Sqrt[(s31 - X[[5, 1]])^2 + (s32 - X[[5, 2]])^2])*s33 - X[[5, 3]] == 0, (1/Sqrt[(s11 - X[[6, 1]])^2 + (s12 - X[[6, 2]])^2])* s13 + (1/Sqrt[(s21 - X[[6, 1]])^2 + (s22 - X[[6, 2]])^2])* s23 + (1/Sqrt[(s31 - X[[6, 1]])^2 + (s32 - X[[6, 2]])^2])*s33 - X[[6, 3]] == 0, (1/Sqrt[(s11 - X[[7, 1]])^2 + (s12 - X[[7, 2]])^2])* s13 + (1/Sqrt[(s21 - X[[7, 1]])^2 + (s22 - X[[7, 2]])^2])* s23 + (1/Sqrt[(s31 - X[[7, 1]])^2 + (s32 - X[[7, 2]])^2])*s33 - X[[7, 3]] == 0, (1/Sqrt[(s11 - X[[8, 1]])^2 + (s12 - X[[8, 2]])^2])* s13 + (1/Sqrt[(s21 - X[[8, 1]])^2 + (s22 - X[[8, 2]])^2])* s23 + (1/Sqrt[(s31 - X[[8, 1]])^2 + (s32 - X[[8, 2]])^2])*s33 - X[[8, 3]] == 0, (1/Sqrt[(s11 - X[[9, 1]])^2 + (s12 - X[[9, 2]])^2])* s13 + (1/Sqrt[(s21 - X[[9, 1]])^2 + (s22 - X[[9, 2]])^2])* s23 + (1/Sqrt[(s31 - X[[9, 1]])^2 + (s32 - X[[9, 2]])^2])*s33 - X[[9, 3]] == 0}, {s11, 130}, {s12, 54}, {s13, 11}, {s21, 125}, {s22, 10}, {s23, 34}, {s31, 5}, {s32, 33}, {s33, 8}, DampingFactor -> 2, AccuracyGoal -> 4, MaxIterations -> 15 ] but "findroot" exits with: FindRoot::"cvnwt": "Newton's method failed to converge to the prescribed \ accuracy after \!\(15\) iterations." But THERE'S a solution because I constructed the 9 Points using a given S and just disturbed them with a random-value between 0 and 1. So is there a sensible way to calculate the S sucht that the the error is minimal? perhaps the way I constructed them: given arbitrary X and Y the following equation calculates the Z. ll[a_, b_] = Sum[(1/Sqrt[( S[[i, 1]] - a)^2 + ( S[[i, 2]] - b)^2])*S[[i, 3]], {i, 1, 3}] + Random[]; with the following S S = {{130, 54, 11}, {125, 10, 34}, {5, 33, 8}}; Help would be greatly appreciated. Cu, Sebastian -- Sebastian Pokutta e-mail: sebastian at pokutta.de oder sebastian.pokutta at uni-essen.de icq: 91203033 [sometimes simple means less than a week work :D] [don't drink and derive]