version 1.2, 1999/12/17 02:21:41 |
version 1.4, 2000/03/06 09:59:50 |
|
|
(* $OpenXM: OpenXM/src/ox_math/lib/primadec.m,v 1.1 1999/12/15 03:40:36 ohara Exp $ *) |
(* $OpenXM: OpenXM/src/ox_math/lib/primadec.m,v 1.3 2000/01/20 15:00:02 ohara Exp $ *) |
|
|
(* |
(* |
usage: |
usage: |
Line 12 In[2]:= primadec[{x^2-3*x+2},{x}] |
|
Line 12 In[2]:= primadec[{x^2-3*x+2},{x}] |
|
Out[2]= {{{-1 + x}, {-1 + x}}, {{-2 + x}, {-2 + x}}} |
Out[2]= {{{-1 + x}, {-1 + x}}, {{-2 + x}, {-2 + x}}} |
*) |
*) |
|
|
asirRtostr[x_] := Module[ |
|
{list = {}, i, s}, |
|
If[ x[[0]] === List, |
|
list = Append[list, " [ " ]; |
|
If[ Length[x] > 0 , |
|
list = Append[list, asirRtostr[ x[[1] ] ] ]; |
|
For[i=2, i<= Length[x], i++, |
|
list = Append[list, " , "]; |
|
list = Append[list, asirRtostr[ x[[i]] ] ] |
|
] |
|
]; |
|
list = Append[list, " ] "]; |
|
s = StringJoin[list], |
|
s = ToString[x, InputForm] |
|
] |
|
] |
|
|
|
primadec[polys_List, vars_List] := Block[ |
primadec[polys_List, vars_List] := Block[ |
{s}, |
{s, expr, fd}, |
s = StringJoin[ |
s = StringJoin[ |
{"m_rtostr(primadec( ", asirRtostr[polys], " , ", asirRtostr[vars], " ));"}]; |
{"m_rtostr(primadec( ", asirRtostr[polys], " , ", asirRtostr[vars], " ));"}]; |
OxExecuteString[s]; |
fd = OxStart["ox_asir"]; |
ToExpression[OxPopString[]] |
OxExecuteString[fd, s]; |
|
expr = ToExpression[OxPopString[fd]]; |
|
OxClose[fd]; |
|
Return[expr] |
] |
] |
|
|
Install[Environment["OpenXM_HOME"] <> "/bin/math2ox"] |
Get[Environment["OpenXM_HOME"] <> "/lib/math/oxclient.m"] |
OxStart["ox_asir"] |
|