Re: What’s the equivalent of Mathematica ’s Solve[] Function in Pari/Gp ?
Laël Cellier <[email protected]>
| Newsgroups | gmane.comp.mathematics.pari.user |
|---|---|
| Message-ID | <[email protected]> |
So, looks pari/gp isn’t as powerfull as Mathematica and even less than
Casio for symbolic solving…
How can I get Pari/gp to automatically rewrite something like :
((25)^2 + x RSA260)/(y) == c
Le 12/01/2025 à 11:58, Karim Belabas a écrit :
> Hi Laël,
>
> Bill's question was about the algorithm used, not the result.
>
> To solve a*x + b*y = c in {x,y} integers (given a,b,c integers) in GP:
>
> Solve(a,b,c) =
> { my([u, v, d] = gcdext(a, b));
>
> if (c % d, return ([])); \\ no solution
> my(x = c/d * u % (b/d));
> [x, (c - a*x) / b];
> }
>
> ? Solve(300001,4139891237,5)
> %1 = [1952821586, -141513]
> ? 1952821586 * 300001 - 141513*4139891237
> %2 = 5
>
> Cheers,
>
> K.B.