Does anyone know of an approximation to raising a negative base to a
fractional exponent? For example, (3)^4.11111 since this cannot be
computed without using imaginary numbers. Any help is appreciated. 10 9817 sc*********@gma il.com wrote:
Does anyone know of an approximation to raising a negative base to a
fractional exponent? For example, (3)^4.11111 since this cannot be
computed without using imaginary numbers. Any help is appreciated.
A couple of questions.
1. How do you approximate a complex number in the reals? That doesn't
make sense.
2. x ^ 4.1111 = 1 / (x ^ 4.1111), so where do complex numbers enter
into this anyway?
3. I think you will find the complex numbers start to emerge as you
explore fractional exponents.
This being Python, and an interactive interpreter being available, you
can always just try it:
>>3 ** 4.1111
0.0109271476078 30808
>>1 ** 2
1.0
>>(1+0j) ** (2)
(1+0j)
>>(1+0j) ** (0.5)
(6.123233995736 766e17+1j)
>>(3 + 0j) ** (4.1111 + 0j)
(0.010268290423 6017750.0037369461622 949107j)
>>>
regards
Steve

Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Sorry, the dog ate my .sigline so I couldn't cat it
Steve Holden wrote:
sc*********@gma il.com wrote:
>Does anyone know of an approximation to raising a negative base to a fractional exponent? For example, (3)^4.11111 since this cannot be computed without using imaginary numbers. Any help is appreciated.
A couple of questions.
1. How do you approximate a complex number in the reals? That doesn't
make sense.
2. x ^ 4.1111 = 1 / (x ^ 4.1111), so where do complex numbers enter
into this anyway?
When *x* is negative and the exponent is fractional.

Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
 Umberto Eco
On Oct 17, 8:03 am, Steve Holden <st...@holdenwe b.comwrote:
schaefer...@gma il.com wrote:
Does anyone know of an approximation to raising a negative base to a
fractional exponent? For example, (3)^4.11111 since this cannot be
computed without using imaginary numbers. Any help is appreciated.
A couple of questions.
1. How do you approximate a complex number in the reals? That doesn't
make sense.
2. x ^ 4.1111 = 1 / (x ^ 4.1111), so where do complex numbers enter
into this anyway?
3. I think you will find the complex numbers start to emerge as you
explore fractional exponents.
This is part of the story  the other part is that the story differs
depending on whether x is positive or negative.
>
This being Python, and an interactive interpreter being available, you
can always just try it:
>>3 ** 4.1111
0.0109271476078 30808
Steve, Trying to memorise the operator precedence table for each of
several languages was never a good idea. I admit advanced age :) and
give up and use parentheses, just like the OP did:
>>(3)**4.11111
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: negative number cannot be raised to a fractional power
Best regards,
John
On Oct 16, 2:48 pm, schaefer...@gma il.com wrote:
Does anyone know of an approximation to raising a negative base to a
fractional exponent? For example, (3)^4.11111 since this cannot be
computed without using imaginary numbers. Any help is appreciated.
Use complex numbers. They are part of python (no special modules
needed).
Just write your real number r, as r+0j
e.g. squareroot of 4 is 2j
>>(4+0j)**(0.5)
(1.224606353822 3773e16+2j) # real part is almost zero
>>> (4.234324+0j)**( 0.5)
(1.259965216411 6278e16+2.0577473119 894969j)
>>2.05774731198 94969j ** 2
(4.234324+0j)
>>>
Karthik sc*********@gma il.com wrote:
Does anyone know of an approximation to raising a negative base to a
fractional exponent? For example, (3)^4.11111 since this cannot be
computed without using imaginary numbers. Any help is appreciated.
As others have said, you can use Python's complex numbers (just write 3
as 3+0j). If for some reason you don't want to, you can do it all with
reals using Euler's formula,
(3)^4.11111 = (1)^4.11111 * 3^4.11111
=
e^(j*pi*4.11111) * 3^4.11111
=
(cos(pi*4.11111) + j*sin(pi*4.11111)) * 3^4.11111
in Python:
>>import math real_part = (3**4.11111) * math.cos(4.11111 * math.pi) imaj_part = (3**4.11111) * math.sin(4.11111 * math.pi) (real_part,im aj_part)
(0.010268060212 11755, 0.0037372276904 401318)
Ken
John Machin wrote:
On Oct 17, 8:03 am, Steve Holden <st...@holdenwe b.comwrote:
>schaefer...@gm ail.com wrote:
>>Does anyone know of an approximation to raising a negative base to a fractional exponent? For example, (3)^4.11111 since this cannot be computed without using imaginary numbers. Any help is appreciated.
A couple of questions.
1. How do you approximate a complex number in the reals? That doesn't make sense.
2. x ^ 4.1111 = 1 / (x ^ 4.1111), so where do complex numbers enter into this anyway?
3. I think you will find the complex numbers start to emerge as you explore fractional exponents.
This is part of the story  the other part is that the story differs
depending on whether x is positive or negative.
>This being Python, and an interactive interpreter being available, you can always just try it:
> >>3 ** 4.1111
0.0109271476078 30808
Steve, Trying to memorise the operator precedence table for each of
several languages was never a good idea. I admit advanced age :) and
give up and use parentheses, just like the OP did:
>>>(3)**4.11111
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: negative number cannot be raised to a fractional power
Best regards,
John
Well I guess I'd better admit to advances age too. Particularly since
there was a pythondev thread about precedence, unaries and
exponentiation not too long ago.
regards
Steve

Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Sorry, the dog ate my .sigline so I couldn't cat it
On Oct 17, 4:05 am, Ken Schutte <kschu...@csail .mit.eduwrote:
schaefer...@gma il.com wrote:
Does anyone know of an approximation to raising a negative base to a
fractional exponent? For example, (3)^4.11111 since this cannot be
computed without using imaginary numbers. Any help is appreciated.
As others have said, you can use Python's complex numbers (just write 3
as 3+0j). If for some reason you don't want to, you can do it all with
reals using Euler's formula,
(3)^4.11111 = (1)^4.11111 * 3^4.11111
=
e^(j*pi*4.11111) * 3^4.11111
=
(cos(pi*4.11111) + j*sin(pi*4.11111)) * 3^4.11111
in Python:
>>import math
>>real_part = (3**4.11111) * math.cos(4.11111 * math.pi)
>>imaj_part = (3**4.11111) * math.sin(4.11111 * math.pi)
>>(real_part,im aj_part)
(0.010268060212 11755, 0.0037372276904 401318)
Ken
Thank you for this. Now I need to somehow express this as a real
number. For example, I can transform the real and imaginary parts into
a polar coordinate giving me the value I want:
z = sqrt( real_part**2 + imaj_part**2 )
but this is an absolute terms. How does one determine the correct sign
for this value? sc*********@gma il.com wrote:
On Oct 17, 4:05 am, Ken Schutte <kschu...@csail .mit.eduwrote:
>schaefer...@gm ail.com wrote:
>>Does anyone know of an approximation to raising a negative base to a fractional exponent? For example, (3)^4.11111 since this cannot be computed without using imaginary numbers. Any help is appreciated.
As others have said, you can use Python's complex numbers (just write 3 as 3+0j). If for some reason you don't want to, you can do it all with reals using Euler's formula,
(3)^4.11111 = (1)^4.11111 * 3^4.11111 = e^(j*pi*4.11111) * 3^4.11111 = (cos(pi*4.11111) + j*sin(pi*4.11111)) * 3^4.11111
in Python:
> >>import math real_part = (3**4.11111) * math.cos(4.11111 * math.pi) imaj_part = (3**4.11111) * math.sin(4.11111 * math.pi) (real_part,im aj_part)
(0.01026806021 211755, 0.0037372276904 401318)
Ken
Thank you for this. Now I need to somehow express this as a real
number. For example, I can transform the real and imaginary parts into
a polar coordinate giving me the value I want:
z = sqrt( real_part**2 + imaj_part**2 )
but this is an absolute terms. How does one determine the correct sign
for this value?
This is a complex number with nonzero imaginary part  there is no way
to "express it as a real number". Depending what you are trying to do,
you may want the magnitude, z, which is by definition always positive.
Or, maybe you just want to take real_part (which can be positive or
negative). Taking just the real part is the "closest" real number, in
some sense. sc*********@gma il.com writes:
[...]
Thank you for this. Now I need to somehow express this as a real
number. For example, I can transform the real and imaginary parts into
a polar coordinate giving me the value I want:
z = sqrt( real_part**2 + imaj_part**2 )
but this is an absolute terms. How does one determine the correct sign
for this value?
If you mean the angle
>>import math x = (3 + 0j) ** (37/9.) math.atan2(x. imag, x.real) * (180 / math.pi)
19.999999999999 95
John This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics 
by: Brian van den Broek 
last post by:
Hi all,
I guess it is more of a maths question than a programming one, but it
involves use of the decimal module, so here goes:
As a selfdirected learning exercise I've been working on a script to
convert numbers to arbitrary bases. It aims to take any of whole
numbers (python ints, longs, or Decimals), rational numbers (n / m n,
m...

by: Jason 
last post by:
Hi, below is example code which demonstrates a problem I have encountered.
When passing a number to a function I compare it with a string's size and
then take certain actions, unfortunately during the testing of it I
discovered that negative numbers were being treated as if they were > 0. I
compiled the following on mingw compiler/dev...

by: Dave 
last post by:
Hello NG,
Regarding accessdeclarations and member usingdeclarations as used to
change the access level of an inherited base member...
Two things need to be considered when determining an inherited base member's
access level in the derived class: its access level in the base class and
the type of inheritance (public, protected, or...

by: Ben Finney 
last post by:
Howdy all,
Okay, so Guido doesn't like Abstract Base Classes, and interfaces
are the way of the future. But they're not here now, and I
understand ABCs better.
I want my modules to (sometimes) define an abstract base exception
class, that all other exceptions in that module inherit from.
class FooException(Exception):

by: Peter Ammon 
last post by:
What's the most negative double value I can get? Is it always
guaranteed to be DBL_MAX? If so, why (or rather, where)?
Thanks.
 
by: Just Me 
last post by:
If a derived class handles MyBase.Mouseup does the base class have to raise
the event?
If both the base and derived class handle it will they both receive it?
If the base overrides OnMouseup and does MyBase.OnMouseUp(mea) does that
effect any of the above answers?
Thanks in advance for any insight passed along

by: better_cs_now 
last post by:
Hello all,
I'd like to get the negative value of largest possible magnitude for a
float. I've considered:
numeric_limits<float>::max()
and
numeric_limits<float>::infinity()

by: emin.shopper 
last post by:
I had a need recently to check if my subclasses properly implemented
the desired interface and wished that I could use something like an
abstract base class in python. After reading up on metaclass magic, I
wrote the following module. It is mainly useful as a light weight tool
to help programmers catch mistakes at definition time (e.g.,...

by: thatwhiteguy 
last post by:
I am trying to create a function that computes a negative exponent. This is what I have, but it is not returning the proper answer. I was wondering if anyone can see where I have gone wrong. Thanks
//This function raises 1+AIR to a negative n power
float power (int num_of_pay, float number)
{
float result;
int i;
double AIR;

by: marktang 
last post by:
ONU (Optical Network Unit) is one of the key components for providing highspeed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...

by: Hystou 
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
 
by: Oralloy 
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bitfields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...

by: Hystou 
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...

by: isladogs 
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...

by: conductexam 
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...

by: TSSRALBI 
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LANtoLAN VPNs.
The last exercise I practiced was to create a LANtoLAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...

by: adsilva 
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
 
by: bsmnconsultancy 
last post by:
In today's digital era, a welldesigned website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
 