0

This is an extension of a previous question involving geometric positioning. I've been able to reduce this problem to a system of three quadratic equations but I need to implement a generalized solution for this that I can solve via computer program for a variety of constants.

I can solve this using Wolfram Alpha - but I need to implement the code to solve this on the fly in a computer program. I DO know the approximate values of A, B and C (and I know they are all positive values for my desired geometric solution) so I can rule out some of the multiple solutions.

I believe this is solved with the Newtonian method using a Jacobian matrix - but I do not know how to reduce this to a format I can program within a computer.

If someone can point me in the right direction I would be grateful.

I am new to this forum so if my means of asking questions is inappropriate I apologize.

Problem - A generalized computer algorithm to solve the following system of equations for a, b and c where K1-K6 are constants.

$a^2+b^2-a*b*k1-k2=0$

$b^2+c^2-b*c*k3-k4=0$

$c^2+a^2-c*a*k5-k6=0$

  • So do just need a way to code up your function and Jacobian? If so what language are you using and what do you have so far? – David Jan 20 '20 at 05:57
  • I am using Processing. I don't really have a start yet on solving this part of the problem. But it's someone can help me with an approach in pseudocode I'm sure I can work out the programming – Dave Franchino Jan 20 '20 at 11:18
  • The iteration is simply $\vec x_{n+1}=\vec x_n-J^{-1}(\vec x_n)F(\vec x_n)$ where $J^{-1}$ is the inverse of the Jacobian matrix and $F$ is a vector with the values of the left-hand-side of your equations (so $F(a,b,c)=[a^2+b^2-abk_1-k_2, b^2+c^2+\ldots,\ldots]^T$). In practice you would first use a linear solver to find $b$ satisfying $J\vec b=F$ for the current $\vec x_n$ and then do $\vec x_{n+1}=\vec x_n-\vec b$ for as many steps as necessary. – David Jan 20 '20 at 22:28

1 Answers1

1

You changed the question since, in the previous one, we had $k_2=k_4=k_6$ which did allow some simplifications (but wich showed the existence of multiple solutions).

In the most general case you address here, assuming that you have good estimates of the parameters what I should better try is the minimization of $$\Phi(a,b,c)=(a^2+b^2-abk_1-k_2)^2+(b^2+c^2-bck_3-k_4)^2+(c^2+a^2-cak_5-k_6)^2$$ for which you can easily provide the analytical Jacobian and Hessian.

Just for safety, I should add as many bound contraints as possible (at least, minimum and maximum values for $(a,b,c)$).

Edit

In comments, the values you gave do not match the equations; they should be exactly (according to the equations) $$k_1=1.993349495550\qquad k_3=1.994903943032\qquad k_5= 1.98275218355$$

Working with the above numbers, starting with $a=b=c=1300$ and allowing a $10$% margin for each of them, the iterates are $$\left( \begin{array}{cccc} a & b & c & \Phi(a,b,c) \\ 1300.00 & 1300.00 & 1300.00 & 1.3996\times 10^8 \\ 1337.12 & 1419.49 & 1315.20 & 1.2038\times 10^8 \\ 1346.20 & 1430.00 & 1333.36 & 9.1054\times 10^7 \\ 1333.40 & 1430.00 & 1381.90 & 8.5893\times 10^6 \\ 1236.45 & 1344.28 & 1309.17 & 5.7573\times 10^6 \\ 1219.67 & 1327.98 & 1292.57 & 2.9684\times 10^1 \\ 1219.57 & 1327.87 & 1292.46 & 0. \end{array} \right)$$ The problem is that, as in your previous post, there is another solution corresponding to $a=1320.95$, $b=1212.09$, $c=1259.22$.

Using your numbers for $(k_1,k_3,k_5)$, the iterates are

$$\left( \begin{array}{cccc} a & b & c & \Phi(a,b,c) \\ 950.000 & 850.000 & 900.000 & 3.4401\times 10^6 \\ 946.968 & 837.191 & 886.560 & 2.1286\times 10^4 \\ 945.852 & 836.411 & 885.888 & 6.5630\times 10^{-2} \\ 945.850 & 836.409 & 885.886 & 0. \end{array} \right)$$

  • Claude,. Yes the previous example was based on an equilateral triangle. I have made this example more generalized to allow me to use non equilateral base triangles. I can place fairly good bounds on the values for a, b and c. I don't understand the value of squaring and the terms and adding them together. Since all equations add to zero you couldn't just add them up and set them to zero cuz you're not? I will try to do more internet research on analytical Jacobian and Hessian. I still don't know where to start. – Dave Franchino Jan 20 '20 at 11:37
  • @DaveFranchino. This is one of the ways to solve systems of nonlinear equations. If you want, send me a set of values for the $k_i$'s, the estimates for $(a,b,c)$ and their bounds. I have a code which is ready and I should add my results to the answer (hust to show the path to solution). Notice that the Hessina is more than simple and we can limit to the analytical Jacobian or even compute it numerically. – Claude Leibovici Jan 20 '20 at 11:42
  • Claude, Sorry I need to leave for work and I can't figure out how to message you directly. I can send you the mathcad if that would help.

    K1 = 1.986698991 K2 = 22500 K3 = 1.9898079 K4 = 10000 K5 = 1.9655044 K6 = 32500

    This should evaluate to a = 945.849, b = 836.408, c = 885.884

    (I evaluated this graphically with my CAD program)

    – Dave Franchino Jan 20 '20 at 11:54
  • Here are the actual calculations before evaluating the Ks

    $a^2+b^2-2ab(1-(57.665^2/(2500^2))-150^2=0$ $b^2+c^2-2bc(1-(50.478^2/(2500^2))-100^2=0$ $c^2+a^2-2ca(1-(92.865^2/(2500^2))-(150^2+100^2)=0$

    – Dave Franchino Jan 20 '20 at 12:00
  • Claude, Did you solve this manually yourself or did you use some computer program (or Wolfram?). I have been studying how to do this using Newton's method with a Jacobian inverse matrix. I have found examples for doing a system of 2 equations and if that can be applied to three equations I believe I understand the concept. It seems quite tedious and error prone - but I will start in on that and perhaps use Wolfram to check my progress - unless there is a better way. Thank you very much. – Dave Franchino Jan 20 '20 at 15:52
  • @DaveFranchino. I used the minimization procedure with a code of mine. – Claude Leibovici Jan 20 '20 at 15:57