1

I have been reading for the last hour about different ways to take an nth root in sage. I am having trouble finding a way to do so for very large numbers.

Any help would be much appreciated. I have tried ^(1/n) and pow and a number of others.

MathIsHard
  • 2,733
  • 16
  • 47
  • x^(1/n), x**(1/n), or pow(x,1/n) should all work. If the problem is that you want a concrete number rather than a symbolic expression, try n(x^(1/n)) to find the approximate numerical value of an expression. You might also want to run tutorial() to open a browser window with the tutorial. – András Salamon Oct 10 '16 at 02:28
  • When I do those it just appends ^(1/5) for example to my number... It doesn't actually do the operation. – MathIsHard Oct 10 '16 at 02:32
  • This is my number 383359376317228026832765614031101780857214373741934853796883469684751393959423303934031779306976105234618634914722122231966050161090557311139688754390702005669975825514220776140658553598335180339644221202109745240693646681489614040361698983885974381266138822986136754230956173498395067036601233601299698337833849969027885834924082799260330843401454066113756946449729494314541583444719025620597701816509274146453 – MathIsHard Oct 10 '16 at 02:34
  • This is M^(1/5) – MathIsHard Oct 10 '16 at 02:34
  • 383359376317228026832765614031101780857214373741934853796883469684751393959423303934031779306976105234618634914722122231966050161090557311139688754390702005669975825514220776140658553598335180339644221202109745240693646681489614040361698983885974381266138822986136754230956173498395067036601233601299698337833849969027885834924082799260330843401454066113756946449729494314541583444719025620597701816509274146453^(1/5) – MathIsHard Oct 10 '16 at 02:35
  • See also https://ask.sagemath.org/question/35102/nth-root-of-huge-number/ – kcrisman Oct 10 '16 at 02:45
  • @kcrisman that is my post on that site too. There are no answers yet. – MathIsHard Oct 10 '16 at 02:47
  • 1
    @ryBear - yes, I just try to help cross-ref for people searching later. – kcrisman Oct 10 '16 at 02:50
  • And I will post my answer in both places though it may not be what you are looking for. – kcrisman Oct 10 '16 at 02:50

1 Answers1

3

If you are looking for a numerical approximation, there are several routes open to you. Here are two.

  • You can approximate after taking it with e.g. a.n(digits=100), like here
  • You can use a decimal point like 383. instead of 383 and then do the root

More advanced options include setting a "real field" with a certain accuracy like R=RealField(1000) and using that ...

kcrisman
  • 2,195
  • 1
    There's also nth_root function and method, and real_nth_root https://doc.sagemath.org/html/en/reference/functions/sage/functions/other.html#sage.functions.other.Function_real_nth_root – PM 2Ring Dec 17 '22 at 09:02