Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Negative numbers and fractional powers
Python doesn't like it when I ask it things like, (-6)**(1/3). I can at least get some answer by changing it to (-6+0j)**(1/3), and it gives me a complex answer, but that's not quite complete, because in the complex plane, numbers have three cube roots. I can get multiple roots using [mpmath.root(a,b,k) for k in range(b)] (returning a**(1/b)), but that only works for whole-number roots, rather than arbitrary real exponents.

Is there a function out there somewhere that can give me every solution to an arbitrary a**b? I already use Sympy, so it would be great if it could work symbolically to give exact answers.
possibly Sage?

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Def code does not work for negative integers. doug2019 1 364 Oct-31-2019, 11:00 PM
Last Post: ichabod801
  offset can not be negative in jollydragon 6 1,182 Sep-28-2019, 03:08 AM
Last Post: jollydragon
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 682 May-09-2019, 12:19 PM
Last Post: Pleiades
  comparing fractional parts of floats Skaperen 4 759 Mar-19-2019, 03:19 AM
Last Post: casevh
  Positive to negative bernardoB 6 825 Mar-13-2019, 07:39 PM
Last Post: bernardoB
  Python regex with negative set of characters multiline sonicblind 2 943 Jul-30-2018, 08:43 PM
Last Post: sonicblind
  negative to positive slices Skaperen 3 1,502 Jan-29-2018, 05:47 AM
Last Post: Skaperen
  Replace only '-' values with NaN, don't remove minus sign for negative numbers. rajpython 2 3,000 Sep-10-2017, 01:23 PM
Last Post: ichabod801
  Negative lookahead not working, help please MitchBuchanon 8 2,819 Mar-01-2017, 02:41 PM
Last Post: Ofnuts
  Fractional Exponent Question Flexico 2 2,668 Dec-04-2016, 01:00 AM
Last Post: Flexico

Forum Jump:

Users browsing this thread: 1 Guest(s)