Difference between revisions of "ApCoCoA-1:Hom.LRSolve"

From ApCoCoAWiki
(New page: <command> <title>Hom.HSolve</title> <short_description>Solves a zero dimensional square homogeneous or non-homogeneous polynomial system of equations.</short_description> <syntax> Hom.HSol...)
 
Line 16: Line 16:
  
 
<example>
 
<example>
-- An example of zero dimensional Non-Homogeneous Solving using the polyhedral homotopy.
+
-- We want to solve the given system for Gamma=0.2+1.2*I and using default configurations.
-- We want to solve zero dimensional non-homogeneous system x^2+y^2-5=0, xy-2=0.  
+
-- The start solution for the homotopy is [ [0.0, 0.0 ], [1.0, 0.0], [0.0, 0.0], [1.0, 0.0] ].
 +
-- The start system for the homotopy is [ x[1],x[2]-1,x[3],x[4]-1,x[1]^2 - x[1], x[2]^2 - x[2], x[3]^2 - x[3], x[4]^2 - x[4] ].  
  
Use S ::= QQ[x,y];               
+
Use S ::= QQ[x[1..4]];               
P := [x^2+y^2-5, xy-2];
+
P := [
 +
186x[1]x[2]x[3]x[4] - 42x[1]x[2]x[3] - 24x[1]x[2]x[4] - 18x[1]x[3]x[4] - 48x[2]x[3]x[4] + 9x[1]x[2] - 6x[1]x[3] + 9x[2]x[3] +
 +
15x[2]x[4] + 9x[3]x[4] + 15x[1] + 15x[3] - 15,
 +
186x[1]x[2]x[3]x[4] - 42x[1]x[2]x[3] - 24x[1]x[2]x[4] - 48x[1]x[3]x[4] - 18x[2]x[3]x[4] + 9x[1]x[2] + 9x[1]x[3] - 6x[2]x[3] +
 +
15x[1]x[4] + 9x[3]x[4] + 15x[2] + 15x[3] - 15,
 +
186x[1]x[2]x[3]x[4] - 48x[1]x[2]x[3] - 18x[1]x[2]x[4] - 42x[1]x[3]x[4] - 24x[2]x[3]x[4] + 9x[1]x[2] + 9x[1]x[3] + 15x[2]x[3] -
 +
6x[1]x[4] + 9x[3]x[4] + 15x[1] + 15x[4] - 15,
 +
24x[1]x[2]x[3]x[4] - 3x[1]x[3] - 3x[2]x[3] - 3x[1]x[4] - 3x[2]x[4] + 3,
 +
x[1]^2 - x[1],
 +
x[2]^2 - x[2],
 +
x[3]^2 - x[3],
 +
x[4]^2 - x[4]
 +
];
 +
SSys := [ x[1],x[2]-1,x[3],x[4]-1,x[1]^2 - x[1], x[2]^2 - x[2], x[3]^2 - x[3], x[4]^2 - x[4] ];
 +
Gamma := <quotes>0.2+1.2*I</quotes>;
 +
SSol := [ [ [<quotes>0.0</quotes>, <quotes>0.0</quotes>], [<quotes>1.0</quotes>, <quotes>0.0</quotes>], [<quotes>0.0</quotes>, <quotes>0.0</quotes>], [<quotes>1.0</quotes>, <quotes>0.0</quotes>] ] ];
 +
ConfigSet := [<quotes>USERHOMOTOPY: 1</quotes>];
  
-- Then we compute the solution with
 
Hom.HSolve(P);
 
 
-- Now you have to interact with ApCoCoAServer
 
-- Enter 1 for the polyhedral homotopy and 2 for the classical linear homotopy.
 
-- If we enter 1 then the all finite solutions are:
 
 
----------------------------------------
 
[
 
[[2, 0], [1, 0]],
 
[[-1, 0], [-2, 0]],
 
[[-2, 0], [-1, 0]],
 
[[1, 0], [2, 0]]
 
]
 
 
 
 
-- The smallest list represents a complex number. For example above system has 4 solutions the first solution is [[2, 0], [1, 0]]
 
-- and we read it as  x=2+0i, y=1+0i
 
 
</example>
 
<example>
 
-- An example of zero dimensional Homogeneous Solving using the classical linear homotopy.
 
-- We want to solve zero dimensional homogeneous system x^2-y^2=0, xy-y^2=0.
 
 
Use S ::= QQ[x,y];           
 
M := [x^2-y^2, xy-y^2];
 
  
 
-- Then we compute the solution with
 
-- Then we compute the solution with
Hom.HSolve(M);
+
Bertini.BUHSolve(P, SSys, Gamma, SSol, ConfigSet);
 
 
-- Now you have to interact with ApCoCoAServer
 
-- Enter 1 for the polyhedral homotopy and 2 for the classical linear homotopy.
 
-- If we enter 2 then the all finite solutions are:
 
  
 +
-- And we achieve a list of lists containing real solutions.
 
----------------------------------------
 
----------------------------------------
[
 
[[20597740658111043/500000000000000000000000, -74403123210058537/1000000000000000000000000],
 
  [20597740658111043/500000000000000000000000, -74403123210058537/1000000000000000000000000]],
 
[[0, 0], [0, 0]],
 
[[0, 0], [0, 0]],
 
[[-60689558229793541/10000000000000000000000000, 245542879738863/2000000000000000000000], 
 
  [-3034482281801981/500000000000000000000000, 3069286290270979/25000000000000000000000]]
 
]
 
  
 +
[[0, 1, 0, 1]]
  
-- The smallest list represents a complex number. For example above system has 4 solutions the first solution is
+
--For Bertini output files please refer to ApCoCoA directory/Bertini.
-- [[20597740658111043/500000000000000000000000, -74403123210058537/1000000000000000000000000],
 
--  [20597740658111043/500000000000000000000000, -74403123210058537/1000000000000000000000000]]
 
-- and we read it as  x=20597740658111043/500000000000000000000000 - 74403123210058537/1000000000000000000000000i,
 
-- y = 20597740658111043/500000000000000000000000 - 74403123210058537/1000000000000000000000000i
 
 
 
 
 
------------------------------------
 
 
</example>
 
</example>
  
<example>
 
-- An example of zero dimensional Non-Homogeneous Solving using the polyhedral homotopy.
 
-- We want to solve zero dimensional non-homogeneous system x[1]^2-1=0, x[1]x[2]-1=0.
 
 
Use QQ[x[1..2]];         
 
P := [x[1]^2-1, x[1]x[2]-1];
 
 
-- Then we compute the solution with
 
Hom.HSolve(P);
 
 
-- Now you have to interact with ApCoCoAServer
 
-- Enter 1 for the polyhedral homotopy and 2 for the classical linear homotopy.
 
-- We enter 1 because we want to use polyhedral homotopy.
 
-- The all finite solutions are:
 
 
----------------------------------------
 
[
 
[[1, 0], [1, 0]],
 
[[-1, 0], [-1, 0]]
 
]
 
 
 
-- The smallest list represents a complex number. For example above system has 2 solutions the first solution is [[1, 0], [1, 0]]
 
-- and we read it as  x[1]=1+0i, x[2]=1+0i
 
 
</example>
 
  
  

Revision as of 10:50, 22 July 2010

Hom.HSolve

Solves a zero dimensional square homogeneous or non-homogeneous polynomial system of equations.

Syntax

Hom.HSolve(P:LIST)

Description

Please note: The function(s) explained on this page is/are using the ApCoCoAServer. You will have to start the ApCoCoAServer in order to use it/them.

The use of this function is two folds depending on the input that you provide in ApCoCoAServer during execution. After passing the command HSolve(P) in CoCoA you need to interact with ApCoCoAServer. At this stage ApCoCoAServer asks you to enter 1 for the polyhedral homotopy and enter 2 for the classical linear homotopy. As a result this function provides all isolated solutions of a zero dimensional system of polynomial equations. The system of polynomials may be homogeneous or nonhomogeneous.

  • @param P: List of polynomials of the given system.

  • @return A list of lists containing the finite solutions of the system P.


Example

-- We want to solve the given system for Gamma=0.2+1.2*I and using default configurations. 
-- The start solution for the homotopy is [ [0.0, 0.0 ], [1.0, 0.0], [0.0, 0.0], [1.0, 0.0] ].
-- The start system for the homotopy is [ x[1],x[2]-1,x[3],x[4]-1,x[1]^2 - x[1], x[2]^2 - x[2], x[3]^2 - x[3], x[4]^2 - x[4] ]. 

Use S ::= QQ[x[1..4]];              
P := [
186x[1]x[2]x[3]x[4] - 42x[1]x[2]x[3] - 24x[1]x[2]x[4] - 18x[1]x[3]x[4] - 48x[2]x[3]x[4] + 9x[1]x[2] - 6x[1]x[3] + 9x[2]x[3] + 
15x[2]x[4] + 9x[3]x[4] + 15x[1] + 15x[3] - 15, 
186x[1]x[2]x[3]x[4] - 42x[1]x[2]x[3] - 24x[1]x[2]x[4] - 48x[1]x[3]x[4] - 18x[2]x[3]x[4] + 9x[1]x[2] + 9x[1]x[3] - 6x[2]x[3] + 
15x[1]x[4] + 9x[3]x[4] + 15x[2] + 15x[3] - 15, 
186x[1]x[2]x[3]x[4] - 48x[1]x[2]x[3] - 18x[1]x[2]x[4] - 42x[1]x[3]x[4] - 24x[2]x[3]x[4] + 9x[1]x[2] + 9x[1]x[3] + 15x[2]x[3] - 
6x[1]x[4] + 9x[3]x[4] + 15x[1] + 15x[4] - 15, 
24x[1]x[2]x[3]x[4] - 3x[1]x[3] - 3x[2]x[3] - 3x[1]x[4] - 3x[2]x[4] + 3, 
x[1]^2 - x[1], 
x[2]^2 - x[2], 
x[3]^2 - x[3], 
x[4]^2 - x[4]
];
SSys := [ x[1],x[2]-1,x[3],x[4]-1,x[1]^2 - x[1], x[2]^2 - x[2], x[3]^2 - x[3], x[4]^2 - x[4] ];
Gamma := <quotes>0.2+1.2*I</quotes>;
SSol := [ [ [<quotes>0.0</quotes>, <quotes>0.0</quotes>], [<quotes>1.0</quotes>, <quotes>0.0</quotes>], [<quotes>0.0</quotes>, <quotes>0.0</quotes>], [<quotes>1.0</quotes>, <quotes>0.0</quotes>] ] ];
ConfigSet := [<quotes>USERHOMOTOPY: 1</quotes>];


-- Then we compute the solution with
Bertini.BUHSolve(P, SSys, Gamma, SSol, ConfigSet);

-- And we achieve a list of lists containing real solutions.
----------------------------------------

[[0, 1, 0, 1]]

--For Bertini output files please refer to ApCoCoA directory/Bertini.




See also

Introduction to CoCoAServer

Hom.LRSolve

Hom.SRSolve