Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Testing latest pari + WASM + node.js... and it works?! Wow.

28495 views
License: GPL3
ubuntu2004
Function: chinese
Section: number_theoretical
C-Name: chinese
Prototype: GDG
Help: chinese(x,{y}): x,y being both intmods (or polmods) computes z in the
 same residue classes as x and y.
Description:
 (gen):gen      chinese1($1)
 (gen, gen):gen chinese($1, $2)
Doc: if $x$ and $y$ are both intmods or both polmods, creates (with the same
 type) a $z$ in the same residue class as $x$ and in the same residue class as
 $y$, if it is possible.
 \bprog
 ? chinese(Mod(1,2), Mod(2,3))
 %1 = Mod(5, 6)
 ? chinese(Mod(x,x^2-1), Mod(x+1,x^2+1))
 %2 = Mod(-1/2*x^2 + x + 1/2, x^4 - 1)
 @eprog\noindent
 This function also allows vector and matrix arguments, in which case the
 operation is recursively applied to each component of the vector or matrix.
 \bprog
 ? chinese([Mod(1,2),Mod(1,3)], [Mod(1,5),Mod(2,7)])
 %3 = [Mod(1, 10), Mod(16, 21)]
 @eprog\noindent
 For polynomial arguments in the same variable, the function is applied to each
 coefficient; if the polynomials have different degrees, the high degree terms
 are copied verbatim in the result, as if the missing high degree terms in the
 polynomial of lowest degree had been \kbd{Mod(0,1)}. Since the latter
 behavior is usually \emph{not} the desired one, we propose to convert the
 polynomials to vectors of the same length first:
 \bprog
  ? P = x+1; Q = x^2+2*x+1;
  ? chinese(P*Mod(1,2), Q*Mod(1,3))
  %4 = Mod(1, 3)*x^2 + Mod(5, 6)*x + Mod(3, 6)
  ? chinese(Vec(P,3)*Mod(1,2), Vec(Q,3)*Mod(1,3))
  %5 = [Mod(1, 6), Mod(5, 6), Mod(4, 6)]
  ? Pol(%)
  %6 = Mod(1, 6)*x^2 + Mod(5, 6)*x + Mod(4, 6)
 @eprog

 If $y$ is omitted, and $x$ is a vector, \kbd{chinese} is applied recursively
 to the components of $x$, yielding a residue belonging to the same class as all
 components of $x$.

 Finally $\kbd{chinese}(x,x) = x$ regardless of the type of $x$; this allows
 vector arguments to contain other data, so long as they are identical in both
 vectors.
Variant: \fun{GEN}{chinese1}{GEN x} is also available.

Function: _polint_worker
Section: programming/internals
C-Name: nmV_polint_center_tree_worker
Prototype: GGGGG
Help: used for parallel chinese
Doc: used for parallel chinese

Function: _nxMV_polint_worker
Section: programming/internals
C-Name: nxMV_polint_center_tree_worker
Prototype: GGGGG
Help: used for parallel chinese
Doc: used for parallel chinese