473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

complex numbers

5
my problem is to compute an addition , multiplication and division of complex numbers " can any one give a way how to compute it ;
Apr 15 '07 #1
5 1271
sicarie
4,677 Expert Mod 4TB
my problem is to compute an addition , multiplication and division of complex numbers " can any one give a way how to compute it ;
The first step to programming anything is understanding how it works - are you familiar with how that is done mathematically?
Apr 15 '07 #2
soosoo
5
yes i know how to do it in math
Apr 15 '07 #3
sicarie
4,677 Expert Mod 4TB
yes i know how to do it in math
It seems like you'll have several different types of operations - so I would suggest creating a different set of algorithms for each operation, a general set of steps that can be followed to solve any problem of that type.

Once you get the algorithms set up, you can break them down into pseudocode statements, and it's easy to turn into code.
Apr 15 '07 #4
JosAH
11,448 Expert 8TB
my problem is to compute an addition , multiplication and division of complex numbers " can any one give a way how to compute it ;
My guess is that you've never read (part of) Bjarne Stroustrup's book
"The C++ Programming Language". Bjarne is the guy who invented C++ and his
book uses an example Complex class all over the place.

kind regards,

Jos
Apr 15 '07 #5
Savage
1,764 Expert 1GB
As far as we all know the complex number has form:

Expand|Select|Wrap|Line Numbers
  1. complex number=real part+(imaginary unit)*imaginary part
,where imaginary unit
has value of:
Expand|Select|Wrap|Line Numbers
  1. sqrt(-1);
for purposes of basic mathematical operations we can create a struct:

Expand|Select|Wrap|Line Numbers
  1. typedef struct {
  2.                        double re;//real part
  3.                        double im;//imaginary part
  4.  
  5.                      }Tcomplex;
and then create functions like:

Expand|Select|Wrap|Line Numbers
  1. Tcomplex addition(Tcomplex in,Tcomplex out);
  2. Tcomplex divison(Tcomplex in,Tcomplex out);
  3. Tcomplex multiplication(Tcomplex in,Tcomplex out);
Savage
Apr 15 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Blair | last post by:
could someone PLEASE tell me why this doesn't work... ----------------------------------------- #include <complex> using namespace std; typedef complex<long double> cld; void main() { cld...
34
by: Pmb | last post by:
I've been working on creating a Complex class for my own learning purpose (learn through doing etc.). I'm once again puzzled about something. I can't figure out how to overload the assignment...
5
by: Todd Steury | last post by:
Greetings Python'ers: I'm just an amature who occasionally uses Python for complex mathematical models. The current model I'm working with occasionally generates really large numbers that are...
17
by: Chris Travers | last post by:
Hi all; I just made an interesting discovery. Not sure if it is a good thing or not, and using it certainly breakes first normal form.... Not even sure if it really works. However, as I am...
6
by: gc | last post by:
Hi, Why didn't the committee propose a new type for complex numbers with integer components? thanks, gc
1
by: seia0106 | last post by:
Hello, I have an array X=, whose even and odd indices should represent real and imaginary parts of complex numbers. This I want to use in a routine that uses the typedef double Cx; for storing...
3
by: Russ | last post by:
I'd like to get output formatting for my own classes that mimics the built-in output formatting. For example, >>> x = 4.54 >>> print "%4.2f" % x 4.54 In other words, if I substitute a class...
7
by: schaefer.mp | last post by:
To compute the absolute value of a negative base raised to a fractional exponent such as: z = (-3)^4.5 you can compute the real and imaginary parts and then convert to the polar form to get...
25
by: jacob navia | last post by:
The C99 standard forgot to define the printf equivalent for complex numbers Since I am revising the lcc-win implementation of complex numbers I decided to fill this hole with "Z" for...
9
by: void main | last post by:
I'm rather new to complex numbers in C and was wondering, how do I initialize a complex variable properly if the imaginary part is 0. I tried -------- #include <complex.h> float complex c...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.