2
$\begingroup$

I hope you may be able to help me with my problem. I don't know if it is actually possible to do what I want to do, but maybe I overlooked an answer.

I have a system of quadratic equations

$ \begin {pmatrix} y_1 \\ y_2 \\ y_3 \end{pmatrix} = A \cdot \begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix} + B \cdot \begin{pmatrix} x_1^2 \\ x_2^2 \\ x_3^2 \end{pmatrix} + C\cdot \begin{pmatrix} x_1\cdot x_3 \\ x_2\cdot x_3 \\ x_1\cdot x_2 \end{pmatrix} $

The matrices A and B and the y vector are given. I have been solving the system of equations with matlab with a solve() function. I have been varying the values of $y_1, y_2$ and $y_3$, which has been working fine so far. However, I ran into problems when trying to solve the system for a certain value for $y_2 = y_3$. It will work for other values and $y_2 = y_3$.

When I try to solve the equations for $y_3 = 0.99999999 \cdot y_2$ with $y_2$ being the problematic value, it will work just fine. I haven't figured out why this is the case. Therefore I wanted to check if the system is still solvable with $y_2 = y_3$ by checking for independence.

Is there another way to check if it still solvable? Or might it be another problem, maybe the solver just not being able to solve it?

Thank you in advance! Your help is appreciated.

edit:

The values of the vectors and matrices are

$ \begin {pmatrix} 750 \\ 1500 \\ 1500 \end{pmatrix} = \begin {pmatrix} 500 & 0 & 0 \\ 500 & 500 & 0 \\ 0 & 0 & 500 \end{pmatrix} \cdot \begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix} + \begin {pmatrix} 0 & 0 & 0 \\ -19.581 & -15.053 & 0 \\ 0 & 0 & -15.053 \end{pmatrix} \cdot \begin{pmatrix} x_1^2 \\ x_2^2 \\ x_3^2 \end{pmatrix} + \begin {pmatrix} 0 & 0 & 0 \\ 11.32 & 11.32 & -34.634 \\ 11.32 & 11.32 & 0 \end{pmatrix} \cdot \begin{pmatrix} x_1\cdot x_3 \\ x_2\cdot x_3 \\ x_1\cdot x_2 \end{pmatrix}$

The problem arose while I was trying to calculate the currents required for a certain power to be converterted at certain points in an asymmetrical electrical dc network. Basically I'm looking at a multiterminal bipolar HVDC network in metallic return mode and an outage at one station.

What might need to be mentioned is that im using the solver of the symbolic toolbox of matlab.

$\endgroup$
5
  • $\begingroup$ There might not be a solution e.g. $x_1 = 1$ and $x_1 = 2$ does not have a solution. See what parameters/conditions/error message solve returns. $\endgroup$
    – user186104
    Aug 18, 2016 at 10:21
  • $\begingroup$ The solver doesn't return any warnings or errors. When I run the programm with the critical values for $y_2$ and $y_3$ it just returns wrong values. When I solve it symbolically it doesn't return any warings or errors either. $\endgroup$ Aug 18, 2016 at 10:23
  • $\begingroup$ Add the values of A and B and y to the question. $\endgroup$
    – user186104
    Aug 18, 2016 at 10:25
  • $\begingroup$ For the mixed terms, I would have expected the order to be $(x_2 x_3, x_3 x_1, x_1 x_2).$ What is the source of the problem? $\endgroup$
    – Will Jagy
    Aug 18, 2016 at 18:21
  • $\begingroup$ I thought it the order of the elements in the vector didn't matter as it equals a summation of the elements multiplied with the matrix. Please correct me if I'm wrong on that. $\endgroup$ Aug 19, 2016 at 11:11

1 Answer 1

1
$\begingroup$

I use Maxima the code and results are below:

E1 : -750 + 500*x1;
E2 : -1500 + 500*x1 + 500*x2 -19.581*x1^2 -15.053*x2^2 + 9.58*x1*x3 + 9.58*x2*x3 -34.634*x1*x2;
E3 : -1500 + 500*x3 -15.053*x3^2 + 9.58*x1*x3 + 9.58*x2*x3;

solve([E1,E2,E3],[x1,x2,x3]);

[x1 = 1.5, x2 = 85.96972563859981, x3 = 87.74766355140187], 
[x1 = 1.5, x2 = 29.27408993576017, x3 = 1.959984609465179], 
[x1 = 1.5, x2 = 1.655006858710562, x3 = 3.102202145680407], 
[x1 = 1.5, x2 = 0.4651535380507343, x3 = 31.2810650887574]

The results are not very accurate? Substituting each result back into the three equations:

           subst(R[1],[E1,E2,E3]);
    (%o13)        [0.0, 0.004048568953294307, - 0.007026502295047976]
    (%i14) subst(R[2],[E1,E2,E3]);
    (%o14)        [0.0, - 7.914470367040849e-4, 2.623238295029751e-6]
    (%i15) subst(R[3],[E1,E2,E3]);
    (%o15)        [0.0, - 1.355784513634717e-5, 1.001358072869607e-4]
    (%i16) subst(R[4],[E1,E2,E3]);
    (%o16)        [0.0, 1.999027597321401e-5, - 0.001041557330609066]

https://www.wolframalpha.com/input/?i=-750+%2B+500*x1+%3D+0,+-1500+%2B+500*x1+%2B+500*x2+-19.581*x1%5E2+-15.053*x2%5E2+%2B+9.58*x1*x3+%2B+9.58*x2*x3+-34.634*x1*x+%3D+0,+-1500+%2B+500*x3+-15.053*x3%5E2+%2B+9.58*x1*x3+%2B+9.58*x2*x3

Wolfram gives:

x3 (9.58 x1+9.58 x2+500.)-15.053 x3^2-1500.≈-15.053 x3^2+500. x3-1500.

Using the grobner basis package in maxima:

load(affine);

grobner_basis([-750 + 500*x1,-1500 + 500*x1 + 500*x2 -19.581*x1^2 -15.053*x2^2 + 9.58*x1*x3 + 9.58*x2*x3 -34.634*x1*x2,-1500 + 500*x3 -15.053*x3^2 + 9.58*x1*x3 + 9.58*x2*x3]);

Gives:

$$\left(-576830960000000\right)\,{\it x_3}+\left(- 5411710412472\right)\,{\it x_2}^3+643257403387460\,{\it x_2}^2+ \left(-15004525334998746\right)\,{\it x_2}+24884658413238003 = 0$$

$$ \left(-10823420824944\right)\,{\it x_2}^4+1270279675537504\, {\it x_2}^3+\left(-29892020931835112\right)\,{\it x_2}^2+ 58711593597479768\,{\it x_2}+\left(-20969575034285991\right) = 0$$

$$ \left(-2\right)\,{\it x_1}+3 = 0$$

The third equation gives $x_1 = 1.5$.

The second equation gives a fourth order polynomial in $x_2$.

The first equation is linear in $x_3$ and cubic in $x_2$.

So solve for $x_2$ then substitute into the first equation to find $x_3$.

plot2d(R[2],[x2,-20,100]);

enter image description here

This is what the second equation ($x_2^4$) looks like.

enter image description here

Notice that it rises from zero to approx. $1e16$ very quickly.

You may require higher floating point precision to get accurate answers.

$\endgroup$
21
  • $\begingroup$ Thank you very much for your answer! I noticed that I gave you the wrong value for one of the parameters. It's 11.32 instead of 9.58 ( The original value given was 283/25 and I somehow miscalculated). However I took your maxima code and solved the equations with the correct value. The result in maxima is the same as it is with Matlab when I use 1500.000001 instead of 1500. $\endgroup$ Aug 19, 2016 at 11:08
  • $\begingroup$ The Maxima code I used is:E1 : -750 + 500*x1; E2 : -1500 + 500*x1 + 500*x2 -19.581*x1^2 -15.053*x2^2 + 283/25*x1*x3 + 283/25*x2*x3 -34.634*x1*x2; E3 : -1500 + 500*x3 -15.053*x3^2 + 283/25*x1*x3 + 283/25*x2*x3; solve([E1,E2,E3],[x1,x2,x3]); The results are: [[x1=1.5,x2=128.3092105263158,x3=130.067615658363],[x1=1.5, x2=29.41272189349112,x3=1.823754789272031],[x1=1.5,x2= 1.618653629183904,x3=3.066596194503171],[x1=1.5,x2=0.3262285375962108 ,x3=31.41758793969849]] $\endgroup$ Aug 19, 2016 at 11:12
  • $\begingroup$ The Matlab code I used the calculate the results are:syms Idpos1 Idpos2 Idneg eqn1= 500*Idpos1 == 750; eqn2 = (Idpos1 + Idpos2)*(283/25*Idneg-19581/1000*Idpos1-15053/1000*Idpos2+500)==1500; eqn3 = Idneg*(283/25*Idpos1-15053/1000*Idneg+283/25*Idpos2+500) == 1500; sol = solve([eqn1, eqn2, eqn3],Idpos1, Idpos2, Idneg); double(sol.Idpos1) double(sol.Idpos2) double(sol.Idneg) $\endgroup$ Aug 19, 2016 at 11:15
  • $\begingroup$ and I get the following results: x1 = 1.5000 1.5000 1.5000 1.5000 x2 = -58.9756 +15.4073i -58.9756 -15.4073i 2.0922 + 0.0000i -15.5194 + 0.0000i x3 = -2.3057 - 4.9518i -2.3057 + 4.9518i 3.0300 + 0.0000i 5.9634 + 0.0000i $\endgroup$ Aug 19, 2016 at 11:17
  • 1
    $\begingroup$ @Heribert Schnackenwurst : its an "ill conditioned system of equations". The floating point resolution is not high enough to deal with cancellations in the algorithms used. $\endgroup$
    – user186104
    Aug 19, 2016 at 12:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .