tony . reix on Thu, 09 Mar 2023 16:28:45 +0100
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Be able to use sqrt(2) as I (square root of -1)
- To: firstname.lastname@example.org
- Subject: Be able to use sqrt(2) as I (square root of -1)
- From: email@example.com
- Date: Thu, 9 Mar 2023 16:27:32 +0100 (CET)
- Delivery-date: Thu, 09 Mar 2023 16:28:45 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laposte.net; s=lpn-wlmd; t=1678375655; bh=Vu5xicInDRbGQ3QqMB2jLnISUcnJAezC9uA8Jobp+vw=; h=Date:From:Reply-To:To:Message-ID:Subject:MIME-Version:Content-Type; b=jLkUeH+4g5FRG8qrllFKnWp0A1yGfl1lX3jqGK60Ti+8dFdWX9jMq+AEUgNsEeU8Q9sSw9jBZ+Dt45qUZySQhe34kSf+WZa5HCjAUf/9MrGWCN/OzQV6xsg6TunfjqB9eiRd2gZZB900Tkb3D7OZX9jiNeaC0sKAMMaSWDHw5g8jeqsRWSphSDFfmnxKS0FRFOV1MpPkq+Wo4wHOFur4GQnoJ0AXcrU1lEOcfv+dRUJDKdjYV/MHCyD+6D60fqOQaE8Ej6y3pooAjmNJLyuSZXnpmERNbeZ7CY67pMXXujYF5pSt4F4JZu8RkGnE9RvIUOBng0piFHmHA5YpjOzSvw==;
- Reply-to: firstname.lastname@example.org
Pari/gp knows that I^2=-1 and thus each time I^2 appears in a computation, it is replaced by -1 .
I'd like to have the same behavior for sqrt(2): a name like R2 such that whenever a computation involves R2^2, it replaces it by 2.
I'm running a suite Vn that involves very big numbers which are a product of sqrt(2) when n is odd, and a true integer when n is even.
sqrt(2) is used as a symbolic value, which vanishes from time to time from Vn, and I do modulo computation, with Vn when n is even, or when Vn/sqrt(2) when n is odd.
For now, I'm using: lift(Mod(floor(v1/sqrt(2)),w)) . That's OK up to a big value of Vn (n < 101), till floor() says:
floor: precision too low in truncr (precision loss in truncation).
Morever, I'm not sure that the results are correct after some dozens of iterations.
printf("V%3d: %3d V%3d: %3d\n", 2*i,
V100: 67 V101: 116
*** at top-level: ...%3d: %3d\n",2*i,lift(Mod(floor(v0),w)),2*i+1,l
*** floor: precision too low in truncr (precision loss in truncation).
*** Break loop: type 'break' to go back to GP prompt
I've tried to find a solution in the documentation of Pari/gp. I failed.
I tried to do something like the following, and I see that Mod() is able to do interesting stuff:
%113 = 3*A + 5
%114 = 9*A^2 + 30*A + 25
%115 = Mod(2, 7)*A^2 + Mod(2, 7)*A + Mod(4, 7)
But I don't know how to go further. Is there some function for parsing this polynome and translate A^2 in 2 when it appears ?
Do you have a solution ?