[FRIAM] Euler's Identity in 3
Marcus Daniels
marcus at snoutfarm.com
Tue Mar 9 17:20:22 EST 2021
Or,
$ ginsh
ginsh - GiNaC Interactive Shell (GiNaC V1.7.11)
__, _______ Copyright (C) 1999-2020 Johannes Gutenberg University Mainz,
(__) * | Germany. This is free software with ABSOLUTELY NO WARRANTY.
._) i N a C | You are welcome to redistribute it under certain conditions.
<-------------' For details type `warranty;'.
Type ?? for a list of help topics.
> exp(Pi*I);
-1
>
-----Original Message-----
From: Friam <friam-bounces at redfish.com> On Behalf Of u?l? ???
Sent: Tuesday, March 9, 2021 12:55 PM
To: FriAM <friam at redfish.com>
Subject: [FRIAM] Euler's Identity in 3
So, I'm trying to learn Rust. And in thinking about the ontological status of mathematical representations of waves (https://arxiv.org/abs/2101.10873), I figured I'd validate Euler's identity:
fn main() {
let e = num::complex::Complex::new(std::f32::consts::E,0.);
let e2ip = e.powc(num::complex::Complex::new(0.,std::f32::consts::PI));
let i = num::complex::Complex::new(0.,1.);
println!("ln(e^iπ) = {}",e2ip.ln());
println!("ln(-1) = {}", i.powi(2).ln()); } $ cargo run
ln(e^iπ) = 0+3.1415925i
ln(-1) = 0+3.141592653589793i
I don't have any idea if that's a reasonable way to do that, since I'm ignorant of Rust. But it's interesting to contrast it with R and Sage:
$ Rscript -e "log(exp(1)^((0+1i)*pi));log((0+1i)^2)"
[1] 0+3.141593i
[1] 0+3.141593i
sage: numerical_approx(ln(e^(i*pi)));numerical_approx(ln(i^2))
3.14159265358979*I
3.14159265358979*I
The precision difference between the 2 results in Rust is interesting. It's the same if I use powf() instead of powi(). Any clues? Or should I simply RTFM?
--
↙↙↙ uǝlƃ
- .... . -..-. . -. -.. -..-. .. ... -..-. .... . .-. .
FRIAM Applied Complexity Group listserv
Zoom Fridays 9:30a-12p Mtn GMT-6 bit.ly/virtualfriam un/subscribe http://redfish.com/mailman/listinfo/friam_redfish.com
FRIAM-COMIC http://friam-comic.blogspot.com/
archives: http://friam.471366.n2.nabble.com/
More information about the Friam
mailing list