Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12974 > unrolled thread

Problem with Expand and Modulus in Mathematica 9?

Started byRalf Hemmecke <hemmecke@gmail.com>
First post2012-12-28 10:33 +0000
Last post2013-01-03 02:14 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Problem with Expand and Modulus in Mathematica 9? Ralf Hemmecke <hemmecke@gmail.com> - 2012-12-28 10:33 +0000
    Re: Problem with Expand and Modulus in Mathematica 9? danl@wolfram.com - 2013-01-03 02:14 +0000

#12974 — Problem with Expand and Modulus in Mathematica 9?

FromRalf Hemmecke <hemmecke@gmail.com>
Date2012-12-28 10:33 +0000
SubjectProblem with Expand and Modulus in Mathematica 9?
Message-ID<kbjshb$n13$1@smc.vnet.net>
Can someone confirm that the following code gives different results for r1 for different versions of Mathematica and different operating systems. Or is this just an issue of my installation?

---BEGIN CODE---
m = 2147483629
q = -285170499
q1 = 1/q
q2 = PowerMod[q,-1,m]
Mod[q*q2, m]
p1 = 527660967 + 978421595*n
p2 = 1999783961 + 1587123368*n + 1965760814*n^2
r1 = Expand[q1*p1*p2,Modulus->m]
r2 = Expand[q2*p1*p2,Modulus->m]
s1 = Expand[Expand[q1*p1*p2],Modulus->m]
s2 = Expand[Expand[q2*p1*p2],Modulus->m]
---END CODE

Value of r1
Mathematica 8
    1808010833 + 1914426603*n + 640234431*n^2 + 1087084730*n^3

Mathematica 9 (64bit Debian 6.0)
    1651432217 + 309632549*n + 188919829*n^2 + 1597920481*n^3

Mathematica 9 (32bit Debian 6.0, 64bit CPU)
    1823075307 + 33175446*n + 2081129601*n^2 + 580053941*n^3

The values of r2, s1, s2 agree with that of r1 as computed in Mathematica 8.

Ralf

[toc] | [next] | [standalone]


#13023

Fromdanl@wolfram.com
Date2013-01-03 02:14 +0000
Message-ID<kc2pii$mdl$1@smc.vnet.net>
In reply to#12974
On Friday, December 28, 2012 4:33:15 AM UTC-6, Ralf Hemmecke wrote:
> Can someone confirm that the following code gives different results for r1 for different versions of Mathematica and different operating systems. Or is this just an issue of my installation?
> 
> 
> 
> ---BEGIN CODE---
> 
> m = 2147483629
> 
> q = -285170499
> 
> q1 = 1/q
> 
> q2 = PowerMod[q,-1,m]
> 
> Mod[q*q2, m]
> 
> p1 = 527660967 + 978421595*n
> 
> p2 = 1999783961 + 1587123368*n + 1965760814*n^2
> 
> r1 = Expand[q1*p1*p2,Modulus->m]
> 
> r2 = Expand[q2*p1*p2,Modulus->m]
> 
> s1 = Expand[Expand[q1*p1*p2],Modulus->m]
> 
> s2 = Expand[Expand[q2*p1*p2],Modulus->m]
> 
> ---END CODE
> 
> 
> 
> Value of r1
> 
> Mathematica 8
> 
>     1808010833 + 1914426603*n + 640234431*n^2 + 1087084730*n^3
> 
> 
> 
> Mathematica 9 (64bit Debian 6.0)
> 
>     1651432217 + 309632549*n + 188919829*n^2 + 1597920481*n^3
> 
> 
> 
> Mathematica 9 (32bit Debian 6.0, 64bit CPU)
> 
>     1823075307 + 33175446*n + 2081129601*n^2 + 580053941*n^3
> 
> 
> 
> The values of r2, s1, s2 agree with that of r1 as computed in Mathematica 8.
> 
> 
> 
> Ralf

Hi Ralf,

Yes, this appears to be problematic, and I have has been reported in house.

For now a workaround is to first do:

SetSystemOptions[
  "PolynomialAlgebraOptions" -> {"PolynomialExpand" -> False}];

Name notwithstanding, this should not actually disable expansion; it simply enables usage, or not, of a certain internal method.

I apologize for any problems this may have caused.

Daniel Lichtblau
Wolfram Research

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web