This is a reformulation of this question to better fit this forum. I removed the mentioning of sage math and this question is now 100% math.
Given, the following quadrilateral:

I want to describe the position of point X in terms of a multiple $t$ of the vector $HG$. The points $H$ and $G$ themselves are described by multiples $s$ of the vectors $DC$ and $AB$, respectively.
We end up with the following equations:
$$ X = H + t(G-H) \\ H = s(C-D)+D \\ G = s(B-A)+A \\ $$
As an example, lets take the following quadrilateral:
$$ A=(1,2) \\ B=(3,2) \\ C=(2,0) \\ D=(0,0) \\ $$
We want to find $s$ and $t$ describing the point $X=(1.25,0.5)$ in the quadrilateral. Here a sketch of the geometric setup:

One can easily see that $X$ cuts $HG$ at $t=0.25$ and that $H$ and $G$ cut $DC$ and $AB$ at $s=0.5$, each.
This is also affirmed by inserting $s=0.5$ and $t=0.25$ into the formulas above. It will result in $H=(1,0)$ and $G=(2,2)$ and $X=(1.25,0.5)$ (the original point).
Now I want a formula which, given any point $X$ inside the quadrilateral gives me $s$ and $t$. To that end I rearrange the above three formulas and solve for $s$ and $t$. After plugging in $H$ and $G$ into $X$, there are two equations, one for the x-coordinates and one for the y-coordinates of the points. Since there are two missing variables $s$ and $t$ this should be solvable.
Since the derivation is super lengthy I started out with letting sage math solve it for me. I wrote about my experience and failure in this question I already mentioned above. To rule out any problem with sage math I ended up doing it by hand. Here is the derivation for $s$:
$$ X = H + t(G-H) \\ H = s(C-D)+D \\ G = s(B-A)+A \\ s = \frac{X_x +t(D_x- A_x) - D_x}{C_x-D_x+t(B_x-A_x-C_x+D_x)} \\ t = \frac{X_y +s(D_y- C_y) - D_y}{A_y-D_y+s(B_y-A_y-C_y+D_y)} \\ $$
Plugging in $t$ into $s$ we arrive at a quadratic equation (my full derivation exists but is commented out for readability - it is the same solution sage math gives):
$$ 0 = as^2 + bs + c \\ s_{1,2} = \frac{-b\pm\sqrt{b^2-4ac}}{2a} \\ a = (D_x-C_x)(B_y-A_y-C_y+D_y)-(D_y-C_y)(B_x-A_x-C_x+Dx) \\ b = (D_y-A_y)(C_x-D_x)+(X_x-D_x)(B_y-A_y-C_y+D_y)-(X_y-D_y)(B_x-A_x-C_x+D_x)-(A_x-D_x)(D_y-C_y) \\ c = (A_y-D_y)(X_x-D_x)-(A_x-D_x)(X_y-D_y) \\ $$
As you can see, one ends up with a quadratic equation with parameters $a$, $b$ and $c$ given in the last lines. My derivations should be correct because as far as I can see they equal the result I got in sage math.
Now, when one plugs in the example values for $A$, $B$, $C$ and $D$ into $a$, then the result will be zero. This will result in a division by zero.
My question: clearly from a geometric point of view, there is a solution for $s$ and $t$ for the example values of $A$, $B$, $C$ and $D$. Why is there none when solving the equation for $s$ and $t$?
And more practically: how can I determine $s$ and $t$ for any given $A$, $B$, $C$, $D$ and $X$ without running into this problem?
If I can find the solution for this, then it would solve this question.
Here the values $a$, $b$ and $c$ that solve $0=at^2+bt+c$:
$$ a = (D_y-A_y)(B_x-A_x-C_x+D_x)-(D_x-A_x)(B_y-A_y-C_y+D_y) \\ b = (D_y-A_y)(C_x-D_x)+(X_y-D_y)(B_x-A_x-C_x+D_x)-(X_x-D_x)(B_y-A_y-C_y+D_y)-(C_y-D_y)(D_x-A_x) \\ c = (C_x-D_x)(X_y-D_y)-(C_y-D_y)(X_x-D_x) \\ $$
Unsurprisingly, the solution for $t$ works analogous to $s$.
You say you get an equation $$as^2 + bs + c = 0$$ for $s$. I believe your derivation is correct (I have not checked it, so I am not sure). You say that the problem is that $a=0$. I see no problem with that:
If it is correct chat $a=0$, well then your equation is actually $bs+c=0$ and the solution is $s=-\frac{c}{b}$.