0
$\begingroup$

Below is my code. If I set W to $10^{55}$, it breaks down and the result is wrong. What do I need to do to use W as large as $10^{200}$?

n = 15;
roots = Table[Sqrt[Prime[i]], {i, n}];
W = 10^45;
A = Table[0, {i, 1,  n + 1}, {j, 1, n + 1}];
A[[1, 1]] = 1; 
For[i = 1, i <= n, i++, A[[1, i + 1]] = Round[W*roots[[i]]];];
For[i = 2, i <= n + 1, i++, A[[i, i]] = W; ];
b = LatticeReduce[A];
q = Abs[b[[1, 1]]]

The error message is here:

N::meprec: Internal precision limit $MaxExtraPrecision = 50.` reached while evaluating -28254824730949473896127703534134355343731647793777+19979178168491741166272766531031078657045486457686 Sqrt[2].

My version is V9, and my OS is windows 7.

$\endgroup$
6
  • $\begingroup$ What do you mean by breakdown? $\endgroup$ Mar 13, 2017 at 4:26
  • $\begingroup$ @AnjanKumar See the error message above. $\endgroup$
    – S. Kohn
    Mar 13, 2017 at 4:47
  • $\begingroup$ In my system, I don't get any error message even for a W of $10^{100}$. You may try increasing $MaxExtraPrecision like this Block[{$MaxExtraPrecision = 100}, Round[W*#] & /@ roots] $\endgroup$ Mar 13, 2017 at 4:51
  • $\begingroup$ This appears to be a version-dependent problem, or we are missing some other information. Please update your question to include the details of your platform. $\endgroup$
    – Mr.Wizard
    Mar 13, 2017 at 5:31
  • $\begingroup$ Thanks for providing version information. This might also be operating-system-dependent so it would be good to know if you are running this on Windows, OSX, or Linux. $\endgroup$
    – Mr.Wizard
    Mar 13, 2017 at 13:15

1 Answer 1

1
$\begingroup$

This appears to work without error in v10.1 under Windows x64:

n = 15;
roots = Table[Sqrt[Prime[i]], {i, n}];
W = 10^200;
A = Table[0, {i, 1, n + 1}, {j, 1, n + 1}];
A[[1, 1]] = 1;
For[i = 1, i <= n, i++, A[[1, i + 1]] = Round[W*roots[[i]]];];
For[i = 2, i <= n + 1, i++, A[[i, i]] = W;];
b = LatticeReduce[A];
q = Abs[b[[1, 1]]]
485603484508849372516130007418504632602233691958877412852766931375138423098986536885\
657362770183762005362519092758826679723076465340151346365557521902058790127411374224\
440956272176411511
$\endgroup$
2
  • $\begingroup$ I see. My version is Version 9. $\endgroup$
    – S. Kohn
    Mar 13, 2017 at 5:37
  • $\begingroup$ @S.Kohn Please include that information in the question itself. You can edit it at any time. $\endgroup$
    – Mr.Wizard
    Mar 13, 2017 at 7:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.