Bottom Page

• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 Negative numbers and fractional powers Flexico Programmer named Tim Posts: 16 Threads: 7 Joined: Dec 2016 Reputation: 0 Likes received: 0 #1 Dec-08-2016, 03:32 PM 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. Larz60+ aetate et sapientia Posts: 9,461 Threads: 338 Joined: Sep 2016 Reputation: 416 Likes received: 1226 #2 Dec-08-2016, 04:12 PM possibly Sage? http://www.sagemath.org/ « Next Oldest | Next Newest »

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 File.seek()? 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)