answersLogoWhite

0


Best Answer

I assume you refer to programming. Classes of complex numbers already exist for many programming languages (for instance, for Java); if you search for them, you can just use the ready-made classes, or - if you have a classroom task of writing your own class - at least get some useful ideas.The general idea is that you define a class with two fields - in Java that would be fields of type "double" - to store the real and imaginary part. Then you define methods for the desired operation and functions, such as addition, subtraction, multiplication, division, sine, cosine, exp, etc.

As an example, to add two numbers, the method "add" can add the number in the object on which it is invoked, and the other number can be passed as a parameter (argument); the answer can be written back to the object. This would be equivalent to:

a = a + b

As an alternative, you can pass two parameters (other complex numbers - i.e., other objects of the type "complex"), and make your object equal to the sum of the two. This would be equivalent to:

a = b + c


User Avatar

Wiki User

βˆ™ 9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you create a class of complex numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the new data types for object oriented language?

Different languages have different data types. But basically, each class can be considered a different data type. For example, if a language doesn't have a data type for dates, create a class, with fields (or properties) to store day, month, year; if your language doesn't have complex numbers, create a class with two fields of some real type to store the real and the imaginary part; if your language doesn't have a data type to store information about a font (its name, size, and characteristics like being or not being bold), create a class to save information about a font, etc.Different languages have different data types. But basically, each class can be considered a different data type. For example, if a language doesn't have a data type for dates, create a class, with fields (or properties) to store day, month, year; if your language doesn't have complex numbers, create a class with two fields of some real type to store the real and the imaginary part; if your language doesn't have a data type to store information about a font (its name, size, and characteristics like being or not being bold), create a class to save information about a font, etc.Different languages have different data types. But basically, each class can be considered a different data type. For example, if a language doesn't have a data type for dates, create a class, with fields (or properties) to store day, month, year; if your language doesn't have complex numbers, create a class with two fields of some real type to store the real and the imaginary part; if your language doesn't have a data type to store information about a font (its name, size, and characteristics like being or not being bold), create a class to save information about a font, etc.Different languages have different data types. But basically, each class can be considered a different data type. For example, if a language doesn't have a data type for dates, create a class, with fields (or properties) to store day, month, year; if your language doesn't have complex numbers, create a class with two fields of some real type to store the real and the imaginary part; if your language doesn't have a data type to store information about a font (its name, size, and characteristics like being or not being bold), create a class to save information about a font, etc.


How do you create a class of complex numbers in c?

You must remember that complex numbers need two parts - a real and an imaginar part, so you have to define fields for these parts. You also need to define methods at least for the basic operations, such as addition, subtraction, multiplication and division. You may also want to define methods for more advanced operations, such as trigonometric functions and the exponential function and natural logarithm, all of which have special definitions in the case of complex numbers.


What does not a real number mean?

It could be an imaginary number or a complex number or on belonging to a higher class of numbers.


What program to add two Complex numbers in java?

I found this class that defines complex numbers, and has the capacity of adding them, and much more: http://www.math.ksu.edu/~bennett/jomacg/c.html Basically, you define a class with two fields, one for the real part, and one for the imaginary part.


What is complex math?

Complex math covers how to do operations on complex numbers. Complex numbers include real numbers, imaginary numbers, and the combination of real+imaginary numbers.


What is the relation of complex numbers to real numbers?

Complex numbers are a proper superset of real numbers. That is to say, real numbers are a proper subset of complex numbers.


Could anyone list numbers not in the set of complex numbers?

No. Complex numbers is the highest set of numbers you can go, and there are no sets outside of complex numbers.


Set of real numbers and set of complex numbers are equivalent?

Real numbers are a proper subset of Complex numbers.


What year did Mr Kbh invent complex numbers?

Complex numbers were not invented by Mr KBH.


What are the kinds of complex numbers?

Complex numbers include real numbers, pure imaginary numbers, and the combination of those two.


Are complex numbers under addition and multiplication a field?

The complex numbers are a field.


Do the complex numbers for a group under binary operation ' plus '?

Yes, the complex numbers, as well as the real numbers which are a subset of the complex numbers, form groups under addition.