Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Math problem - imaginary powers

Author
Message
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 10th Jun 2010 10:59 Edited at: 10th Jun 2010 16:41
I have a little bit of a problem trying to find solutions to (a1+a2*i)^(b1+b2*i). A big problem is that... there are an infinite number of solutions (in most cases). Using euler's equation, I found this:
[code brackets to prevent smilies


So... that's (kind of) all well and good. But... when I try to implement it.. stuff doesn't work right.
here's my code (there are... four or so lines that use cloggy's DLL, but just replace those with dot or circle and it'll run fine. Also ianm's matrixutil's log function).


It gives weird results... but it doesn't appear to be completely wrong... just off by some angle or something. For example, (0+1*i)^(0.5+0*i), or sqrt(i) returns the two values 1*i or -1*i. This is incorrect, but sqrt(1+0*i)^(0.5+0*i), the square root of negative one, is one or negative one. This isn't just a single special case coincidence. Another example:
(1+0*i)^(0.5+0*i) gives 0.70710+0.70710*i and -0.70710-0.70710*i. Obviously incorrect, but true for (0+1*i)^(0.5+0*i).
I don't get what's going on. Any help? i would just swap a1 and a2 but... i have no reason to do so (also it's 1:00 and I have stuff to do tomorrow )


Is't life, I ask, is't even prudence, to bore thyself and bore thy students?
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Jun 2010 11:15 Edited at: 10th Jun 2010 11:17

Just putting this in code brackets for easier reading (without smilies)

I'm afraid it's a bit out of my league but I thought this might help someone who knows maths better than me!

HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 10th Jun 2010 12:42
what happens if you put all the adding parts in brackets and work outward from there, found that what works in excel and qbasic needs more bracketing when you use the code in darkbasic.

Dark Physics makes any hot drink go cold.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 11th Jun 2010 09:01
Ok... well... not too sure why it worked, but switching the x and y values in the atanfull command did the trick.

Pretty cool. It kind of shows how a^n is hard to define. Even when you have real numbers to the power of real numbers, there are loads of imaginary solutions. It also makes cool patterns




Is't life, I ask, is't even prudence, to bore thyself and bore thy students?

Login to post a reply

Server time is: 2026-07-25 16:21:05
Your offset time is: 2026-07-25 16:21:05