Hi,
Why didn't the committee propose a new type for complex numbers with
integer components?
thanks,
gc 6 2260
On Tue, 14 Oct 2003, gc wrote: Why didn't the committee propose a new type for complex numbers with integer components?
At first glance, I would ask: What semantics would you give complex
integer division? Would the identity (a == a/b*b + a%b) still hold?
But considering that you probably *could* give a reasonable answer,
my real answer would be: What use would complex integer math be to
anyone? Complex floating arithmetic is just barely useful to a
vocal minority as it is (IMHO); I don't think anyone really cares
at all about "complex integer" arithmetic!
And if nobody cares, and nobody would use it, why bother to put it
in the Standard?
-Arthur
gc <gu**********@y ahoo.com> wrote: Hi, Why didn't the committee propose a new type for complex numbers with integer components?
Because complex numbers always have a real and imaginary part *per
definitionem* - there aren't "complex integers" and you can't do
"complex counting", so why should the people working on the standard
come up with a type of numbers that even the mathematicans never
did conceive?
Regards, Jens
--
_ _____ _____
| ||_ _||_ _| Je***********@p hysik.fu-berlin.de
_ | | | | | |
| |_| | | | | | http://www.physik.fu-berlin.de/~toerring
\___/ens|_|homs|_|oe rring Je***********@p hysik.fu-berlin.de wrote: gc <gu**********@y ahoo.com> wrote: Hi, Why didn't the committee propose a new type for complex numbers with integer components?
Because complex numbers always have a real and imaginary part *per definitionem* - there aren't "complex integers" and you can't do "complex counting", so why should the people working on the standard come up with a type of numbers that even the mathematicans never did conceive? Regards, Jens
But the mathematicians did conceive of such numbers.
Complex numbers where both the real and imaginary parts are integers
are generally known as Gaussian integers.
Some more information about Gaussian integers can be found at http://mathworld.wolfram.com/GaussianInteger.html
It is a fairly safe assumption that if you can think of a type of
number, some mathematician has already thought about it and written a
paper about them.
The reason Gaussian integers weren't included in the standard is most
likely that they are rarely used. There is not much reason to mandate
support for a feature that only a few programs will ever have any use
for, especially since it is not too difficult to write your own
functions to handle them.
Ordinary complex numbers are used much more often, so for those it made
more sense to have them as part of the language.
--
<Insert your favourite quote here.>
Erik Trulsson er******@studen t.uu.se Je***********@p hysik.fu-berlin.de writes: gc <gu**********@y ahoo.com> wrote: Hi, Why didn't the committee propose a new type for complex numbers with integer components?
Because complex numbers always have a real and imaginary part *per definitionem* - there aren't "complex integers" and you can't do "complex counting", so why should the people working on the standard come up with a type of numbers that even the mathematicans never did conceive? Regards, Jens
Actually, complex integers are a perfectly valid mathematical concept;
they're also known as Gaussian integers. See, for example,
<http://mathworld.wolfr am.com/GaussianInteger .html>.
Gaussian integers aren't directly supported in C because there isn't
much demand for them.
--
Keith Thompson (The_Other_Keit h) ks*@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
> On Tue, 14 Oct 2003, gc wrote: But considering that you probably *could* give a reasonable answer, my real answer would be: What use would complex integer math be to anyone? Complex floating arithmetic is just barely useful to a vocal minority as it is (IMHO); I don't think anyone really cares at all about "complex integer" arithmetic!
Gaussian integers form an integral domain so division need have been
defined or could have been defined in a manner analogous to how the
division operator works for integers in C (the reminder theorem holds
for gaussian integers so I guess it shouldn't be a big deal, the
quotient could have been used).
And if nobody cares, and nobody would use it, why bother to put it in the Standard?
Thats a valid point, for the sake of completeness perhaps, kindly
correct me if I am wrong but wasn't the unary + operator was
introduced for the same reason, I think hardly any coe uses the unary
+ operator. Gaussian integers would be of use for some people.
gc writes: Thats a valid point, for the sake of completeness perhaps, kindly correct me if I am wrong but wasn't the unary + operator was introduced for the same reason, I think hardly any coe [?] uses the unary + operator. Gaussian integers would be of use for some people.
The missing unary plus causes an annoying asymmetry in the syntax. That is
not the case with the integer complex deal. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Peter Olsen |
last post by:
I want to define a class "point" as a subclass of complex.
When I create an instance
sample = point(<arglist>)
I want "sample" to "be" a complex number, but with its real and
imaginary parts computed in point()'s __init__ function with their
values based on the arglist. I want to compute with point instances
as though they were native complex numbers, but I want to be able to
|
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 cmplx, temp;
|
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 operator.
Here's what I'm trying to do. I've defined class Complex as
class Complex {
friend ostream &operator<<( ostream &, Complex & );
public:
Complex( float = 0.0, float = 0.0 );
|
by: Arthur |
last post by:
Spending the morning avoiding responsibilities, and seeing what it would
take to color some complex numbers.
class color_complex(complex):
def __init__(self,*args,**kws):
complex.__init__(*args)
self.color=kws.get('color', 'BLUE')
>>> a=color_complex(1,7)
>>> print a
|
by: Schüle Daniel |
last post by:
Hello
I am trying to customize the handling of complex numbers
what I am missing is a builtin possibility to create
complex numbers in polar coordinates
so first I wrote a standalone function
>>> def polar(r,arg):
.... re, im = r*cos(arg), r*sin(arg)
| |
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 instance for "x" above, I'd
like to make the format string apply to an element or elements of the
instance. Can I somehow overload the "%" operator for that? Thanks.
|
by: Arvid Requate |
last post by:
Hello,
I'd like to understand why the following code does not compile. It
looks like a strangeness in connection with overload resolution for the
<complex> header:
The conversion operator double() of class B is called for the member
complex::operator*=(double) as expected, but not for operator*(complex,
double).
The effect is, that the template matching (or overload resolution)
|
by: perroe |
last post by:
Hi
I have a array of complex numbers that are stored in a simple double
array. This is done since the array is part of an wrapper for an
external C library, and the imaginary part of the first element, and
the last element are known to be 0. I've implemented a -operator
that returns a ComplexReference object that basically maps a
complex<doubleinto the storage used in the array.
What I would like to do is using the ComplexReference...
|
by: Klaas Vantournhout |
last post by:
Hi all,
I was wondering why there is one extra argument for the return values of
complex functions. And why is this not the case with any other data
type (except char)
example :
* In case of a non complex value
|
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 = 1.0f;
--------
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed 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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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 LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |