# Revision history [back]

### Solving equations in polynomial ring if ideal is positive dimensional

I will be outlining the situation, and at the bottom I will describe my actual problems'.

I'm coming from this question, nbruin suggested I use polynomial rings. I'm afraid I'm missing something here. What I did was the following.

P.<a1,a2,b1,b2,q> = QQ[]

def eq(a,b,c,d):
return q*(a**2 + b**2) + 2*(a*c + b*d)

I = ideal( eq(a1,a2,b1,b2), eq(b1,b2,a1,a2) )
B = I.groebner_basis()


Note that my equations are in fact only quadratic.

As I understand from the wiki page on systems of polynomial equations, we can already tell - by looking at the reduced Gröbner basis - whether solutions exist at all.

Sage computes the reduced Gröbner basis, so here is $B$:

a1^3*b1 + a1*a2^2*b1 - a1*b1^3 + a1^2*a2*b2 + a2^3*b2 - a2*b1^2*b2 - a1*b1*b2^2 - a2*b2^3,
a1^2*q + a2^2*q + 2*a1*b1 + 2*a2*b2,
b1^2*q + b2^2*q + 2*a1*b1 + 2*a2*b2


So our system is not inconsistent, but unfortunately it is also not zero dimensional, which is why $\texttt{I.variety()}$ does not work.

My problems:

1.) $q$ is actually just a parameter in the underlying field, or rather in $\mathbb{R}$, that is: for given equations it is constant. But how do I use variables/constants in polynomial rings? I didn't find anything.

2.) In reality, I want to work over $\mathbb{R}$, but I read somewhere it is preferred using $\texttt{QQ}$ or $\texttt{ZZ}$. Changing the base ring doesn't change the solvability tho.

3.) I know there are 4 one-parameter solutions for $\texttt{a1,a2,b1,b2}$. How do I get sage to find an expression for them? ($\text{solve}$ finds them, but this is just a small example of much larger systems I want to solve)

### Solving equations in polynomial ring if ideal is positive dimensional

I will be outlining the situation, and at the bottom I will describe my actual problems'.

I'm coming from this question, nbruin suggested I use polynomial rings. I'm afraid I'm missing something here. What I did was the following.

P.<a1,a2,b1,b2,q> = QQ[]

def eq(a,b,c,d):
return q*(a**2 + b**2) + 2*(a*c + b*d)

I = ideal( eq(a1,a2,b1,b2), eq(b1,b2,a1,a2) )
B = I.groebner_basis()


Note that my equations are in fact only quadratic.

As I understand from the wiki page on systems of polynomial equations, we can already tell - by looking at the reduced Gröbner basis - whether solutions exist at all.

Sage computes the reduced Gröbner basis, so here is $B$:

a1^3*b1 + a1*a2^2*b1 - a1*b1^3 + a1^2*a2*b2 + a2^3*b2 - a2*b1^2*b2 - a1*b1*b2^2 - a2*b2^3,
a1^2*q + a2^2*q + 2*a1*b1 + 2*a2*b2,
b1^2*q + b2^2*q + 2*a1*b1 + 2*a2*b2


So our system is not inconsistent, but unfortunately it is also not zero dimensional, which is why $\texttt{I.variety()}$ does not work.

My problems:

1.) $q$ is actually just a parameter in the underlying field, or rather in $\mathbb{R}$, that is: for given equations it is constant. But how do I use variables/constants in polynomial rings? I didn't find anything.

2.) In reality, I want to work over $\mathbb{R}$, but I read somewhere it is preferred using to use $\texttt{QQ}$ or $\texttt{ZZ}$. Changing the base ring doesn't change the solvability tho.

3.) I know there are 4 one-parameter solutions for $\texttt{a1,a2,b1,b2}$. How do I get sage to find an expression for them? ($\text{solve}$ finds them, but this is just a small example of much larger systems I want to solve)

### Solving equations in polynomial ring if ideal is positive dimensional

I will be outlining the situation, and at the bottom I will describe my actual problems'.

I'm coming from this question, nbruin suggested I use polynomial rings. I'm afraid I'm missing something here. What I did was the following.

P.<a1,a2,b1,b2,q> = QQ[]

def eq(a,b,c,d):
return q*(a**2 + b**2) + 2*(a*c + b*d)

I = ideal( eq(a1,a2,b1,b2), eq(b1,b2,a1,a2) )
B = I.groebner_basis()


Note that my equations are in fact only quadratic.

As I understand from the wiki page on systems of polynomial equations, we can already tell - by looking at the reduced Gröbner basis - whether solutions exist at all.

Sage computes the reduced Gröbner basis, so here is $B$:

a1^3*b1 + a1*a2^2*b1 - a1*b1^3 + a1^2*a2*b2 + a2^3*b2 - a2*b1^2*b2 - a1*b1*b2^2 - a2*b2^3,
a1^2*q + a2^2*q + 2*a1*b1 + 2*a2*b2,
b1^2*q + b2^2*q + 2*a1*b1 + 2*a2*b2


So our system is not inconsistent, but unfortunately it is also not zero dimensional, which is why $\texttt{I.variety()}$ does not work.

My problems:

1.) $q$ is actually just a parameter in the underlying field, or rather in $\mathbb{R}$, that is: for given equations it is constant. But how do I use variables/constants in polynomial rings? I didn't find anything.

2.) In reality, I want to work over $\mathbb{R}$, but I read somewhere it is preferred to use $\texttt{QQ}$ or $\texttt{ZZ}$. Changing the base ring doesn't change the solvability tho.tho (also not with $\text{QQbar}$)

3.) I know there are 4 one-parameter solutions for $\texttt{a1,a2,b1,b2}$. How do I get sage to find an expression for them? ($\text{solve}$ finds them, but this is just a small example of much larger systems I want to solve)

### Solving equations in polynomial ring if ideal is positive dimensional

I will be outlining the situation, and at the bottom I will describe my actual problems'.

I'm coming from this question, nbruin suggested I use polynomial rings. I'm afraid I'm missing something here. What I did was the following.

P.<a1,a2,b1,b2,q> = QQ[]

def eq(a,b,c,d):
return q*(a**2 + b**2) + 2*(a*c + b*d)

I = ideal( eq(a1,a2,b1,b2), eq(b1,b2,a1,a2) )
B = I.groebner_basis()


Note that my equations are in fact only quadratic.

As I understand from the wiki page on systems of polynomial equations, we can already tell - by looking at the reduced Gröbner basis - whether solutions exist at all.

Sage computes the reduced Gröbner basis, so here is $B$:

a1^3*b1 + a1*a2^2*b1 - a1*b1^3 + a1^2*a2*b2 + a2^3*b2 - a2*b1^2*b2 - a1*b1*b2^2 - a2*b2^3,
a1^2*q + a2^2*q + 2*a1*b1 + 2*a2*b2,
b1^2*q + b2^2*q + 2*a1*b1 + 2*a2*b2


So our system is not inconsistent, but unfortunately it is also not zero dimensional, which is why $\texttt{I.variety()}$ does not work.

My problems:

1.) $q$ is actually just a parameter in the underlying field, or rather in $\mathbb{R}$, that is: for given equations it is constant. But how do I use variables/constants in polynomial rings? I didn't find anything.

2.) In reality, I want to work over $\mathbb{R}$, but I read somewhere it is preferred to use $\texttt{QQ}$ or $\texttt{ZZ}$. Changing the base ring doesn't change the solvability tho (also not with $\text{QQbar}$)$\texttt{QQbar}$)

3.) I know there are 4 one-parameter solutions for $\texttt{a1,a2,b1,b2}$. How do I get sage to find an expression for them? ($\text{solve}$ finds them, but this is just a small example of much larger systems I want to solve)

### Solving equations in polynomial ring if ideal is positive dimensional

I will be outlining the situation, and at the bottom I will describe my actual problems'.

I'm coming from this question, nbruin suggested I use polynomial rings. I'm afraid I'm missing something here. What I did was the following.

P.<a1,a2,b1,b2,q> = QQ[]

def eq(a,b,c,d):
return q*(a**2 + b**2) + 2*(a*c + b*d)

I = ideal( eq(a1,a2,b1,b2), eq(b1,b2,a1,a2) )
B = I.groebner_basis()


Note that my equations are in fact only quadratic.

As I understand from the wiki page on systems of polynomial equations, we can already tell - by looking at the reduced Gröbner basis - whether solutions exist at all.

Sage computes the reduced Gröbner basis, so here is $B$:

a1^3*b1 + a1*a2^2*b1 - a1*b1^3 + a1^2*a2*b2 + a2^3*b2 - a2*b1^2*b2 - a1*b1*b2^2 - a2*b2^3,
a1^2*q + a2^2*q + 2*a1*b1 + 2*a2*b2,
b1^2*q + b2^2*q + 2*a1*b1 + 2*a2*b2


So our system is not inconsistent, but unfortunately it is also not zero dimensional, which is why $\texttt{I.variety()}$ does not work.

My problems:

1.) $q$ is actually just a parameter in the underlying field, or rather in $\mathbb{R}$, that is: for given equations it is constant. But how do I use variables/constants in polynomial rings? I didn't find anything.

2.) In reality, I want to work over $\mathbb{R}$, but I read somewhere it is preferred to use $\texttt{QQ}$ or $\texttt{ZZ}$. Changing the base ring doesn't change the solvability tho (also not with $\texttt{QQbar}$)

3.) I know there are 4 one-parameter solutions for $\texttt{a1,a2,b1,b2}$. How do I get sage to find an expression for them? ($\text{solve}$ ($\texttt{solve}$ finds them, but this is just a small example of much larger systems I want to solve)

### Solving equations in polynomial ring if ideal is positive dimensional

I will be outlining the situation, and at the bottom I will describe my actual problems'.

I'm coming from this question, nbruin suggested I use polynomial rings. I'm afraid I'm missing something here. What I did was the following.

P.<a1,a2,b1,b2,q> = QQ[]

def eq(a,b,c,d):
return q*(a**2 + b**2) + 2*(a*c + b*d)

I = ideal( eq(a1,a2,b1,b2), eq(b1,b2,a1,a2) )
B = I.groebner_basis()


Note that my equations are in fact only quadratic.

As I understand from the wiki page on systems of polynomial equations, we can already tell - by looking at the reduced Gröbner basis - whether solutions exist at all.

Sage computes the reduced Gröbner basis, so here is $B$:

a1^3*b1 + a1*a2^2*b1 - a1*b1^3 + a1^2*a2*b2 + a2^3*b2 - a2*b1^2*b2 - a1*b1*b2^2 - a2*b2^3,
a1^2*q + a2^2*q + 2*a1*b1 + 2*a2*b2,
b1^2*q + b2^2*q + 2*a1*b1 + 2*a2*b2


So our system is not inconsistent, but unfortunately it is also not zero dimensional, which is why $\texttt{I.variety()}$ does not work.

My problems:

1.) $q$ is actually just a parameter in the underlying field, or rather in $\mathbb{R}$, that is: for given equations it is constant. But how do I use variables/constants in polynomial rings? I didn't find anything.

2.) In reality, I want to work over $\mathbb{R}$, but I read somewhere it is preferred to use $\texttt{QQ}$ or $\texttt{ZZ}$. Changing the base ring doesn't change the solvability tho (also not with $\texttt{QQbar}$)

3.) I know there are 4 one-parameter solutions for $\texttt{a1,a2,b1,b2}$. How do I Is it possible to get sage to find an expression for them? ($\texttt{solve}$ finds them, but this is just a small example of much larger systems I want to solve)