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
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 303 May-09-2019, 12:19 PM
Last Post: Pleiades
  comparing fractional parts of floats Skaperen 4 430 Mar-19-2019, 03:19 AM
Last Post: casevh
  Positive to negative bernardoB 6 429 Mar-13-2019, 07:39 PM
Last Post: bernardoB
  negative to positive slices Skaperen 3 1,065 Jan-29-2018, 05:47 AM
Last Post: Skaperen
  Replace only '-' values with NaN, don't remove minus sign for negative numbers. rajpython 2 2,165 Sep-10-2017, 01:23 PM
Last Post: ichabod801
  Negative lookahead not working, help please MitchBuchanon 8 2,365 Mar-01-2017, 02:41 PM
Last Post: Ofnuts
  Fractional Exponent Question Flexico 2 1,996 Dec-04-2016, 01:00 AM
Last Post: Flexico

Forum Jump:

Users browsing this thread: 1 Guest(s)