Jump to content

I'm only taking about a simple console application here. I was just wondering how I would convert :

                                      (once converted)

i^2 + 3i^3  + 4i^4 + 2i^5  ----------------->  -1 - 3i +4 +2i => 3-i

 

So I want to enter any arbitrary number eg i^8 +i^20. So would I have to read as a string and then replace with data from a array or something I'm really confused to what a good solution for this would be. 

 

Something somewhat similar to what google does: 

 

054098e16f.png

CPU: Intel 3570 GPUs: Nvidia GTX 660Ti Case: Fractal design Define R4  Storage: 1TB WD Caviar Black & 240GB Hyper X 3k SSD Sound: Custom One Pros Keyboard: Ducky Shine 4 Mouse: Logitech G500

 

Link to comment
https://linustechtips.com/topic/293988-manipulating-complex-numbers-c/
Share on other sites

Link to post
Share on other sites

i^x

 

if x%4==0 => i^x == 1

elseif x%2==0 => i^x == -1

else

   y=x-1

   if y%4==0 => i^x == i

   else y%2==0 => i^x == -i

Is there some way to find all the complex numbers within a string I enter though? that's the part I'm really struggling with, I just fucking suck at programming :( Eg. if the program finds an i it will continue until it reads the rest of the complex number eg. i^50. Then that could be checked in your pseudo code and then  be changed accordingly changed with like string replacement. 

CPU: Intel 3570 GPUs: Nvidia GTX 660Ti Case: Fractal design Define R4  Storage: 1TB WD Caviar Black & 240GB Hyper X 3k SSD Sound: Custom One Pros Keyboard: Ducky Shine 4 Mouse: Logitech G500

 

Link to post
Share on other sites

Is there some way to find all the complex numbers within a string I enter though? that's the part I'm really struggling with, I just fucking suck at programming :(

 

well ... you could just write yourself a parser ...

Mini-Desktop: NCASE M1 Build Log
Mini-Server: M350 Build Log

Link to post
Share on other sites

well ... you could just write yourself a parser ...

Err, I don't know what that is... Do you have a good links to a tutorial on how to make one? 

CPU: Intel 3570 GPUs: Nvidia GTX 660Ti Case: Fractal design Define R4  Storage: 1TB WD Caviar Black & 240GB Hyper X 3k SSD Sound: Custom One Pros Keyboard: Ducky Shine 4 Mouse: Logitech G500

 

Link to post
Share on other sites

Err, I don't know what that is... Do you have a good links to a tutorial on how to make one? 

 

Basically, you walk the input string and identify what each part is and possibly store it in a data structure that makes it easy to find and retrieve those parts.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×