Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: check solutions in systems of polynomial equations
PostPosted: Mon Jul 20, 2009 3:20 pm 
I have the following problem that I want to solve with Singular.
I have an original system with 2 variables and 3 unknowns:
f0=f(x,y)=0;
f1=dx(f)=0;
f2=dy(y)=0;
where dx, dy represent the partial derivatives w.r.t x and y.

I am constructing an equivalent system:
g1=a*f(x,y)+b*dx(f)+c*dy(f)=0
g2=d*f(x,y)+e*dx(f)+g*dy(f)=0,
where a,b,..g are integers.
I am computing the solutions of the equivalent system using "solve" command from Singular.
Then I want to take this solutions, round them and check which of the rounding solutions verify my original system.
Everything is okay in the source code until I want to substitute the rounding solutions into the original system.
Since the lists of solutions SOL[i][1] is defined in a ring, and since subst is defined in another ring, I cannot seem to find a way to substitute the solutions into the original system.

I used the following commands for solving the equivalent system:
Code:
ideal m=g1,g2;
ideal n = groebner(m);
setring r;
def T=solve(n,30,1,"nodisplay");


and then the following commands for substituting the solutions in the original system:
Code:
int k;
for (k=1; k<=size(SOL); k++){
      l[k];
      number solAx = l[k][1];
      number solAy = l[k][2];
           list lsols= list(round(solAx),round(solAy));
      lsols[1];lsols[2];
      //setring r;
      poly f0=-1 + 12*x + 6*x2 + x3 + 6*y - y2;
      poly f1=diff(f0,x);
      poly f2=diff(f0,y);
                setring r;
      subst(f0,lsols[1],y,lsols[2]);
      subst(f1,x,lsols[1],y,lsols[2]);
      subst(f2,x,lsols[1],y,lsols[2]);
                setring T;
   }

Still I get this error message:
`lsols` is not defined
when compiling since lsols is not recognized in the ring r.
I understand perfectly the error, still since I am a beginner in Singular, I don't seem to understand how should I solve this problem or want I should use from Singular to solve it.

Thank you in advance for any suggestions,
madalina


Report this post
Top
  
Reply with quote  
 Post subject: Re: check solutions in systems of polynomial equations
PostPosted: Tue Jul 21, 2009 1:18 pm 
I've solve the problem.
I used "imap" function to map the approximate solutions from the ring "T" to the ring "r", and then I substitute the map solutions into the original system.
I get exactly what I need.

[code]
list newl=imap(T,lsols);
subst(f0,x,newl[1],y,newl[2]);
[code]

madalina.


Report this post
Top
  
Reply with quote  
 Post subject: Re: check solutions in systems of polynomial equations
PostPosted: Tue Jul 21, 2009 1:19 pm 
[quote="Guest"]I've solve the problem.
I used "imap" function to map the approximate solutions from the ring "T" to the ring "r", and then I substitute the map solutions into the original system.
I get exactly what I need.

Code:
list newl=imap(T,lsols);
subst(f0,x,newl[1],y,newl[2]);


madalina.


Report this post
Top
  
Reply with quote  
 Post subject: Re: check solutions in systems of polynomial equations
PostPosted: Tue Jul 21, 2009 1:19 pm 
I've solve the problem.
I used "imap" function to map the approximate solutions from the ring "T" to the ring "r", and then I substitute the map solutions into the original system.
I get exactly what I need.

Code:
list newl=imap(T,lsols);
subst(f0,x,newl[1],y,newl[2]);


madalina.[/quote]


Report this post
Top
  
Reply with quote  
 Post subject: Re: check solutions in systems of polynomial equations
PostPosted: Tue Jul 21, 2009 1:20 pm 
I've solve the problem.
I used "imap" function to map the approximate solutions from the ring "T" to the ring "r", and then I substitute the map solutions into the original system.
I get exactly what I need.

Code:
list newl=imap(T,lsols);
subst(f0,x,newl[1],y,newl[2]);


madalina.


Report this post
Top
  
Reply with quote  
 Post subject: Re: check solutions in systems of polynomial equations
PostPosted: Tue Jul 21, 2009 1:20 pm 
I've solved the problem.
I used "imap" function to map the approximate solutions from the ring "T" to the ring "r", and then I substitute the map solutions into the original system.
I get exactly what I need.

Code:
list newl=imap(T,lsols);
subst(f0,x,newl[1],y,newl[2]);


madalina.


Report this post
Top
  
Reply with quote  
 Post subject: Re: check solutions in systems of polynomial equations
PostPosted: Tue Jul 21, 2009 6:48 pm 
Site Admin

Joined: Wed Nov 12, 2008 5:09 pm
Posts: 20
Madalina,

you may just as well map your polynomials f0, f1, f2 (which live in your initial ring r, say) into the ring T (where SOL also lives). This may in general be better for checking the solutions, as T has a much higher precision, at least in the setup you posted.
By the way, for mapping polynomials, you may also use the more handy command 'fetch'.

Regards,
Frank


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: check solutions in systems of polynomial equations
PostPosted: Fri Jul 24, 2009 10:30 am 
Site Admin

Joined: Wed Nov 12, 2008 5:09 pm
Posts: 20
Madalina,

let me correct my last comment. I was mixing things up a bit. Of course, you should be computing over the rationals in your ring r, i.e. exact. Thus mapping back your 30-digit-precision complex solutions from T to r will result in rationals which exactly preserve this precision. Therefore, it will NOT be more exact to check the solutions in T, contrary to my initial comment.

As to 'fetch', there's actually not much of a difference. In general, 'fetch' maps the i-th ring variable of the first ring to the i-th of the second, whereas 'imap' maps between variables with the same name. Depending on the context, the one or the other may be more useful.

Regards,
Frank


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

It is currently Fri May 13, 2022 11:06 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group