e to the i pi

K

Keith Thompson

Lane Straatman said:
I stated in this thread that I wanted to take e to the i pi and get as close
as I could with it using pre-defined types. I think i^i better suits this
purpose. LS

That makes no sense. e^(i*pi) is -1; i^i is a completely different
real value, approximately 0.20788. I won't waste my time trying to
figure out what you really meant.
 
D

Dave Vandervies

[Snip everything C-related]
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
mathematical proof of this, but I'm too lazy to track it down or
reconstruct it.

Note that e^(i*pi/2) = i (this follows from the theorem that says
e^(i*x)=cos x + i*sin x). This tells us that ln(i) = i*pi/2.

So:
i = e^(ln i)
i^i = (e^(ln i))^i
= e^(ln i * i)

Completing the proof is left as an exercise for the reader.


dave
 
L

Lane Straatman

CBFalconer said:
Dominant? The cockroach population of NYC exceeds the human
population. Does that make them dominant?
Sitting here as I do on Martin Luther King blvd., you need to know that the
only answer I have to that is *yes.* LS
 
L

Lane Straatman

Dave Vandervies said:
[Snip everything C-related]
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
mathematical proof of this, but I'm too lazy to track it down or
reconstruct it.

Note that e^(i*pi/2) = i (this follows from the theorem that says
e^(i*x)=cos x + i*sin x). This tells us that ln(i) = i*pi/2.

So:
i = e^(ln i)
i^i = (e^(ln i))^i
= e^(ln i * i)

Completing the proof is left as an exercise for the reader.
That's a nice touch. LS
 
R

Richard Heathfield

Keith Thompson said:
The "%lf" format specifier is invalid.

Tiny nit time. That is not true in C99, which the above program clearly
must be. See 7.19.6.1(7): "l (ell) [...] has no effect on a following
a, A, e, E, f, F, g, or G conversion specifier."

So "%lf" is equivalent to "%f". So that has nothing to do with his bug
(which, as you noted elsewhere, is probably more to do with the fact
that he has two format specifiers but only one datum, and that being of
the wrong type!).

<snip>
 
M

Malcolm McLean

Keith Thompson said:
Do they *really* require you to agree to that? How can they enforce a
restriction like that? If you distribute your own source code, how
can the fact that you've fed it to their compiler affect your rights?
I suspect the situation isn't that simple.

You can always install Cygwin, which includes gcc (I'm not sure how
much support it has for Windows-specific programming, though).
I think actually the open source restriction applies to anything based on
their samples.
Since the API is so intricate the only sensible way to to take a working
program and modify it, this could be very broad. They are obviously scared
of GNU.

I didn't read the agreement very carefully. I doubt the thing has any legal
force because you are logging into a computer, not signing a binding
contract.

The saga continues. I installed the free C compiler. It compiles "hello
world". But it won't do a Windows program. I didn't buy Vista for its
command shell capabilities, so I download the SDK. Fair enough. The compiler
won't recognise it. After about two hour rooting about on the web, I find a
Microsoft page telling me how to edit various configuration files to get it
to work - two of them, plus paths. Meanwhile the OS merrily throws threats
at every edit. Of course I make a typing mistake. At 1.00 in the morning, I
finally get a "Hello World" - in C++, I haven't figiured out how to get C
mode yet.

I am a programmer not a hacker. Some people might see this as an interesting
challenge. Personally I just see it as a total nuisance which takes times
from what I should be doing, like adding subroutines to BASICdraw. Two days
wasted. This sort of thing is often rationalised as "teething troubles". In
fact it is a constant situation. At work I am struggling with two new
programming environments - R and a new Lisp compiler. In computing, you are
very frequently using software for the first time.
 
K

Keith Thompson

Richard Heathfield said:
Keith Thompson said:
The "%lf" format specifier is invalid.

Tiny nit time. That is not true in C99, which the above program clearly
must be. See 7.19.6.1(7): "l (ell) [...] has no effect on a following
a, A, e, E, f, F, g, or G conversion specifier."

You're right, I missed that.
 
M

Malcolm McLean

Dave Vandervies said:
So:
i = e^(ln i)
i^i = (e^(ln i))^i
= e^(ln i * i)
Wow.That's clever.
Note that e^(i*pi/2) = i (this follows from the theorem that says
e^(i*x)=cos x + i*sin x). This tells us that ln(i) = i*pi/2.
Can't say this bit about e^(i*x) = cos x + i * sin x is too convincing
though. Do you think he's trying to pull a fast one on us?
 
R

Richard Tobin

Keith Thompson said:
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
mathematical proof of this, but I'm too lazy to track it down or
reconstruct 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.

-- Richard
 
R

Richard Tobin

Malcolm McLean said:
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! + ...

-- Richard
 
H

Hallvard B Furuseth

Dave said:
Note that e^(i*pi/2) = i (this follows from the theorem that says
e^(i*x)=cos x + i*sin x).

It also follows from e^(i*pi) + 1 = 0: e^(i*pi)^(1/2) = (-1)^(1/2).
 
L

Lane Straatman

Richard Tobin said:
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?

How many decimal places can we squeeze from a long double? LS
 
W

Walter Roberson

Lane Straatman said:
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.)
 
L

Lane Straatman

Walter Roberson said:
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
 
W

Walter Roberson

Right, what is the minimum maximum? LS

Looks like 31 significant digits.

http://64.233.167.104/search?q=cach...28bit_long_double_floating-point_datatype.htm

Hmmm, odd representation method...

A 128-bit long double number consists of an ordered pair of 64-bit
double-precision numbers. The first member of the ordered pair contains
the high-order part of the number, and the second member contains the
low-order part. The value of the long double quantity is the sum of the
two 64-bit numbers.

Is that the standard mechanism??
 
L

Lane Straatman

Lane Straatman said:
"Lane Straatman" <[email protected]> wrote in message
Am I going to get in trouble with atan as I've got it? LS
de.sci.mathematik identified a possible division by zero and a fix:

#include <stdio.h>
#include <stdlib.h>
#include <complex.h>
#include <math.h>
int main(void)
{
long double complex z1, z3, z4, z5;
long double mod, phi, a, b, c, d;
z1 = .4 + .7I;
a = creal(z1);
b = cimag(z1);
// mod = sqrt(pow(a, 2) + pow(b, 2));
mod = cabs(z1);
// phi = atan(b/a);
phi = carg(z1);
c = ( (sqrt(mod)) * cos( .5 * phi ) );
d = ( (sqrt(mod)) * sin( .5 * phi ) );
z4 = c + d*I;
z5 = cpow(z1, .5);
z3 = cpow(z4, 2.0);
printf("The square root of %lf %lfi\n", creal(z1), cimag(z1));
printf("is : %lf %lfi\n", creal(z4), cimag(z4));
printf("using cpow to get the root: %15lf %15lfi\n", creal(z5),
cimag(z5));
printf("using cpow to check the square: %lf %lfi\n", creal(z3),
cimag(z3));
system("PAUSE");
return 0;
}
/*
Lane Straatman wrote:
Es wird zwar leicht OT, aber seisdrum:
double complex z1, z3, z4, z5;
double mod, phi, a, b, c, d;
a = creal(z1);
b = cimag(z1);
mod = sqrt(pow(a, 2) + pow(b, 2)); mod = cabs(z1);
phi = atan(b/a);
phi = carg(z1);
(Erschlägt auch das Quadranten- und DIV0-Problem.)
system("PAUSE");

Nett.

Viele Grüße
Steffen
*/
Is six digits all I'm going to get out of a long double? LS
 
S

santosh

Richard said:
santosh said:

Let's get this straight. He spent money on a Microsoft product (Visual
C++). He then spent some more money on another Microsoft product
(Vista), as a result of which his first product stopped working. Are
you really suggesting that he gives *even more* money to Microsoft, to
get back the functionality that he has *already paid for*?

Have you ever heard of the expression "throwing good money after bad"?

Okay, I thought he used the freely available Visual C++ Express
Edition, which, I think, prohibits commercial use. If he did buy a
full fleged version of Visual Studio and it's now broken by upgrade to
Vista, then that's indeed a shame. MS does recommend a clean install
instead of an upgrade.

Well, seeing as he's unwilling to move to a better platform, I guess
he has little choice but to reinstall the Latest and Greatest version
of Visual Studio. It was an advice specific to the context. Generally,
I'm not a fan of Microsoft's products, primarily because of their
inflated pricing and general elitism. I haven't used a Windows version
in two years. However some people are tied to it, for one reason or
another and simply telling them to move to Linux, or whatever, doesn't
work.

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++.
 
S

santosh

CBFalconer said:
Dominant? The cockroach population of NYC exceeds the human
population. Does that make them dominant?

Numerically they are. There're many possible definitions of dominant.
Such decisions are usually subjective and hence not authoritative.
 
S

santosh

Malcolm said:
I think actually the open source restriction applies to anything based on
their samples.
Since the API is so intricate the only sensible way to to take a working
program and modify it, this could be very broad. They are obviously scared
of GNU.

I didn't read the agreement very carefully. I doubt the thing has any legal
force because you are logging into a computer, not signing a binding
contract.

The saga continues. I installed the free C compiler. It compiles "hello
world". But it won't do a Windows program. I didn't buy Vista for its
command shell capabilities, so I download the SDK. Fair enough. The compiler
won't recognise it. After about two hour rooting about on the web, I find a
Microsoft page telling me how to edit various configuration files to get it
to work - two of them, plus paths. Meanwhile the OS merrily throws threats
at every edit. Of course I make a typing mistake. At 1.00 in the morning, I
finally get a "Hello World" - in C++, I haven't figiured out how to get C
mode yet.

I am a programmer not a hacker. Some people might see this as an interesting
challenge. Personally I just see it as a total nuisance which takes times
from what I should be doing, like adding subroutines to BASICdraw. Two days
wasted. This sort of thing is often rationalised as "teething troubles". In
fact it is a constant situation. At work I am struggling with two new
programming environments - R and a new Lisp compiler. In computing, you are
very frequently using software for the first time.

Yes.

Tools are now so complex that they tend to create more problems than
they purport to solve. These problems are typically solved by yet more
tools and the vicious cycle continues, feeding the growth of software
engineering and quality assurance.

Standard C is a breath of fresh air in all this quagmire of complexity.
 
L

Lane Straatman

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:
http://www.billfordx.net/screendumps/cstuff_8.htm
Okay, I thought he used the freely available Visual C++ Express
Edition, which, I think, prohibits commercial use. If he did buy a
full fleged version of Visual Studio and it's now broken by upgrade to
Vista, then that's indeed a shame. MS does recommend a clean install
instead of an upgrade.
MS thought that it was fiscally irresponsible to do otherwise. I would try
to use the word "fiduciary" in a sentence with "stockholders," but Eric
Sosman is just waiting to zing me again.
Well, seeing as he's unwilling to move to a better platform, I guess
he has little choice but to reinstall the Latest and Greatest version
of Visual Studio. It was an advice specific to the context. Generally,
I'm not a fan of Microsoft's products, primarily because of their
inflated pricing and general elitism. I haven't used a Windows version
in two years. However some people are tied to it, for one reason or
another and simply telling them to move to Linux, or whatever, doesn't
work.
A person needs to ante up if he wants to get into dotnet.
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top