473,785 Members | 2,573 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

e to the i pi

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <complex.h>
/*
double complex z1, z2, z3;
bool flag;
z1 = .4 + .7I;
z2 = cpow(z1, 2.0);
z3 = z1 * z1;
flag = false;
flag = true;
if (flag)
{
printf("%lf %lf\n", creal(z1), cimag(z1));
printf("%lf %lf\n", creal(z2), cimag(z2));
printf("%lf %lf\n", creal(z3), cimag(z3));
printf("%d\n", N);
}
*/

int main(int argc, char *argv[])
{
double complex z1, z2, z3, z4, z5;
z1=5 +7I;
z2=cpow(z1, 1I);
printf("%lf %lf\n", creal(z1), cimag(z1));
printf("%lf %lf\n", creal(z2), cimag(z2));
z5= 0 + I*(3.14159);

z3=2.54 + 0*I;
z4=cpow(z5,z3);
printf("%lf %lf\n", creal(z4), cimag(z4));

system("PAUSE") ;
return 0;
}
Why doesn't e^(i *pi) equal what most folks think it does? LS
Feb 4 '07
123 4313
In article <eq***********@ pc-news.cogsci.ed. ac.uk>,
Richard Tobin <ri*****@cogsci .ed.ac.ukwrote:
>In article <eL************ *************** ***@bt.com>,
Malcolm McLean <re*******@btin ternet.comwrote :
>>Can't say this bit about e^(i*x) = cos x + i * sin x is too convincing
though.

Consider the polynomial expansion e^x = 1 + x + x^2/2! + x^3/3! + ...
I think you mean "power series expansion". It's only a polynomial if
it's finite.
dave
(knowing the power series expansions for sin and cos would also be helpful)

--
Dave Vandervies dj******@csclub .uwaterloo.ca
>What would you give if somebody used a silly unit (hogsheads) and gave
a good justification for it? --Joe Zeff and Garrett Wollman
More thought. in the scary devil monastery
Feb 7 '07 #101
"Lane Straatman" <in*****@invali d.netwrites:
"Richard Tobin" <ri*****@cogsci .ed.ac.ukwrote in message
news:eq******** ***@pc-news.cogsci.ed. ac.uk...
>In article <ln************ @nuthaus.mib.or g>,
Keith Thompson <ks***@mib.orgw rote:
>>>Apparently i^i (where i is the imaginary square root of -1 and "^"
denotes exponentiation) is a real number. I'm sure there's a simple
mathematic al proof of this, but I'm too lazy to track it down or
reconstruc t it.

It's exp(-pi/2). Someone else showed the proof, but you can just type
"i^i" into Google to see the numerical value.
http://www.billfordx.net/screendumps/cstuff_7.htm

Clearly, this latest version is off. Heathfield says I have two specifiers
for one datum. Is it not a datum with a real and a complex part, both of
which need attention in the conversion specifiers?
[...]

This is in reference to your attempt to print a single complex value
using a printf format that expects two floating-point arguments. I
have tried at least twice to explain this to you. I will not waste my
time doing so again.

In fact, I will not waste my time responding to anything you post, or
offering you any sort of help after this. I just read your article in
comp.std.c,
<http://groups.google.c om/group/comp.std.c/msg/d91bae8783a38bd e>, in
which you replied to a polite, informative, and only mildly critical
article by ku****@wizard.n et with:

| You have the manners of ferrets. F*** yourselves collectively and shove the
| standard up your ***. LS

[edited for content]

It's not inconceivable that that article was a forgery. If so, please
say so. (I don't believe it was.)

Until and unless your behavior improves dramatically, I judge you to
be a troll (deliberate or not, I don't care which), and I will ignore
you. I leave it to others to make their own judgements.

Yes, this is off-topic. I decided to post it anyway as an attempt to
improve this newsgroup's signal-to-noise ratio.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 7 '07 #102

"Dave Vandervies" <dj******@caffe ine.csclub.uwat erloo.cawrote in message
In article <eq***********@ pc-news.cogsci.eds ..ac.uk>,
Richard Tobin <ri*****@cogsci .ed.ac.ukwrote:
>>In article <eL************ *************** ***@bt.com>,
Malcolm McLean <re*******@btin ternet.comwrote :
>>>Can't say this bit about e^(i*x) = cos x + i * sin x is too convincing
though.

Consider the polynomial expansion e^x = 1 + x + x^2/2! + x^3/3! + ...

I think you mean "power series expansion". It's only a polynomial if
it's finite.
dave
(knowing the power series expansions for sin and cos would also be
helpful)
You've got to know them? Why isn't something as simple as opposite /
hypotenuse self evident ?
Feb 7 '07 #103

"Lane Straatman" <in*****@invali d.netwrote in message
>The bigger question is why Malcolm doesn't use a free development
system like MinGW. Combined with the Platform SDK, you can do nearly
everything with it, that you'd do with MSVC++.
I've had a very good experience this last week with Devcpp. Up and
running immediately. I'll post the above link in an ng with MS in the
name and see what comes. LS
I bought Visual Studio when I was still a games programmer. It is handy to
have the same compiler you use at work.
Now I've started a PhD in computer modelling of peptides, and I use a Linux
system for scientific work. However I kept the Visual Studio for doing
little hobby programs, like BASICdraw. I do want people to run my stuff, but
the virus problem means that it is hard to distribute executables. I might
be better off on Linux - sometimes it is better to be a little fish in a
little pond than a little fish in a big one.

So I did actually have a choice, for the first time in many years. I just
assumed that everything would work the same on the new Windows. Now I am not
sure that redm,ond won't remotely delete a dual boot.

http://www.personal.leeds.ac.uk/~bgy1mm

Feb 7 '07 #104
"Malcolm McLean" <re*******@btin ternet.comwrite s:
"Dave Vandervies" <dj******@caffe ine.csclub.uwat erloo.cawrote in message
>In article <eq***********@ pc-news.cogsci.eds ..ac.uk>,
Richard Tobin <ri*****@cogsci .ed.ac.ukwrote:
>>>In article <eL************ *************** ***@bt.com>,
Malcolm McLean <re*******@btin ternet.comwrote :

Can't say this bit about e^(i*x) = cos x + i * sin x is too convincing
though.

Consider the polynomial expansion e^x = 1 + x + x^2/2! + x^3/3! + ...

I think you mean "power series expansion". It's only a polynomial if
it's finite.
dave
(knowing the power series expansions for sin and cos would also be
helpful)
You've got to know them? Why isn't something as simple as opposite /
hypotenuse self evident ?
Because when the lengths of the sides of your right triangle and/or
the angles of its vertices are complex numbers, geometric intuition
breaks down. (At least mine does; if you're able to visualize such
things, I'm impressed.)

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 7 '07 #105
Lane Straatman wrote:
>
.... snip ...
>
It looks slick as all get out. Looks don't count for much though.
I can't find a run button or pull-down and don't want to have to
step outside the IDE to run the executable:
On Windoze, ALT-tab can bring you to the terminal window (dosbox),
on which you compile and run the application just edited. Easier
and quicker than fooling with a brain-dead IDE. You can apply the
same technique, unaltered, to Linux etc.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
Feb 7 '07 #106
On Feb 7, 11:06 am, "Lane Straatman" <inva...@invali d.netwrote:
"Walter Roberson" <rober...@ibd.n rc-cnrc.gc.cawrote in message

news:eq******** **@canopus.cc.u manitoba.ca...I n article <g7KdnYYqcflFYl TYnZ2dnUVZ_sOkn ...@comcast.com >,
Lane Straatman <inva...@invali d.netwrote:
>How many decimal places can we squeeze from a long double? LS
C99 defines minimums for that, but not maximums -- an implementation
could in theory have a long double that was a kilobyte long (or more.)

Right, what is the minimum maximum? LS

The required minimums for long doubles are exactly the same as for
doubles. The minimums for both DBL_DIG and LDBL_DIG are both 10.

In practice, it's often considerably larger. For example, IEEE
doubles will get you 15 decimal digits, 80-bit Intel/x86 style
extended reals (assuming your compiler supports them) will get you 18
digits. Other implementations of extended reals exists - the double-
double format mentioned by Walter Robinson is fairly common in
software implementations , and gets you about 31 decimal digits, the
128 bit extended real on zSeries has a 112 bit mantissa and nets about
33 decimal digits. There is not really a standard for IEEE extended
doubles, but the standard does specify some minimums, which is
approximately what the 80-bit x86 format implements.

Feb 8 '07 #107

"Keith Thompson" <ks***@mib.orgw rote in message
>You've got to know them? Why isn't something as simple as opposite /
hypotenuse self evident ?

Because when the lengths of the sides of your right triangle and/or
the angles of its vertices are complex numbers, geometric intuition
breaks down. (At least mine does; if you're able to visualize such
things, I'm impressed.)
Say we've got three points in three dimensions. Put a line between a, b, and
c. It is just a normal angle. Three points always lie in a plane.
So if our vertices are complex, that makes 4 dimensions, x, xi, y, yi for
each point. But we still have three points.
Do they still lie in a plane, or is the angle between them complex?
Feb 8 '07 #108
"Malcolm McLean" <re*******@btin ternet.comwrite s:
"Keith Thompson" <ks***@mib.orgw rote in message
>>You've got to know them? Why isn't something as simple as opposite /
hypotenuse self evident ?

Because when the lengths of the sides of your right triangle and/or
the angles of its vertices are complex numbers, geometric intuition
breaks down. (At least mine does; if you're able to visualize such
things, I'm impressed.)
Say we've got three points in three dimensions. Put a line between a, b, and
c. It is just a normal angle. Three points always lie in a plane.
So if our vertices are complex, that makes 4 dimensions, x, xi, y, yi for
each point. But we still have three points.
Do they still lie in a plane, or is the angle between them complex?
I think that when you're dealing with trig functions applied to
complex numbers, you're no longer dealing with triangles. A triangle
in any number of dimensions lies in a plane. I'm not sure there's a
geometric interpretation for a triangle with complex sides and/or
angles.

Something like (sin x)^2 + (cos x)^2 = 1 makes sense geometically.
e^(i*x) = cos x + i * sin x, as far as I know, doesn't -- but it does
make sense algebraically. There are infinite series for each of the
exp(), sin(), and cos() functions, derived using their properties for
real numbers. Applying the same series to complex numbers gives you
mathematically useful results -- including cool whacko stuff like
e^(i*pi) + 1 = 0.

I imagine that quaternions would yield some interesting results -- but
standard C doesn't support them, so that's off-topic.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 8 '07 #109
In article <ln************ @nuthaus.mib.or gKeith Thompson <ks***@mib.orgw rites:
"Malcolm McLean" <re*******@btin ternet.comwrite s:
"Keith Thompson" <ks***@mib.orgw rote in message
>You've got to know them? Why isn't something as simple as opposite /
hypotenuse self evident ?

Because when the lengths of the sides of your right triangle and/or
the angles of its vertices are complex numbers, geometric intuition
breaks down. (At least mine does; if you're able to visualize such
things, I'm impressed.)
Say we've got three points in three dimensions. Put a line between a, b,
and c. It is just a normal angle. Three points always lie in a plane.
So if our vertices are complex, that makes 4 dimensions, x, xi, y, yi for
each point. But we still have three points.
Do they still lie in a plane, or is the angle between them complex?

I think that when you're dealing with trig functions applied to
complex numbers, you're no longer dealing with triangles.
Indeed. cos(i.ln(10)) = 5.2.
Something like (sin x)^2 + (cos x)^2 = 1 makes sense geometically.
e^(i*x) = cos x + i * sin x, as far as I know, doesn't -- but it does
make sense algebraically.
Also geometrically. Take the complex plane with real and imaginary
axis. Draw a circle with radius 1 around the origin. exp(i * x)
circles around this circle when x increases.
I imagine that quaternions would yield some interesting results
Not really.
--
dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/
Feb 8 '07 #110

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
11245
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL) on the server because of that. Our site will have an SSL certificate next week, so I would like to use AIM instead of SIM, however, I don't know how to send data via POST over https and recieve data from the Authorize.net server over an https...
2
5840
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues to execute the code until the browser send his reply to the header instruction. So an exit(); after each redirection won't hurt at all
3
23037
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which field is completed.
0
8494
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. 354 roberto@ausone:Build/php-4.3.2> ldd /opt/php4/bin/php libsablot.so.0 => /usr/local/lib/libsablot.so.0 libstdc++.so.5 => /usr/local/lib/libstdc++.so.5 libm.so.1 => /usr/lib/libm.so.1
1
8608
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the column below. The viewer can select states from the drop down lists above the other two columns as well. If the viewer selects only one, only one column fills. If the viewer selects two states, two columns fill. Etc. I could, if appropriate, have...
4
18303
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the user comes back to a page where he had a submitted POST data the browser keeps telling that the data has expired and asks if repost. How to avoid that? I tried registering all POST and GET vars as SESSION vars but
1
6867
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url http://www.mis.gla.ac.uk/biquery/training/ but each of the courses held have maximum of 8 people that could be
2
31442
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value to :parameter I dont like the idea of making the SQL statement on the fly without binding parameters as I dont want a highly polluted SQL cache.
3
23600
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the results of the picture half the size. The PHP I have installed support 1.62 or higher. And all I would like to do is take and image and make it fit a 3x3. Any suggestions to where I should read or look would be appreciated.
0
9647
marktang
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...
0
10356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10098
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,...
0
9958
tracyyun
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...
0
8986
agi2029
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...
1
7506
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6743
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();...
1
4058
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2890
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.