Sponsored Content
Top Forums Programming E**(i*pi)=-1 or e**(j*pi)=-1, something I found out in Python using part of Eulers Identit equation. Post 303042083 by wisecracker on Friday 13th of December 2019 01:54:58 PM
Old 12-13-2019
E**(i*pi)=-1 or e**(j*pi)=-1, something I found out in Python using part of Eulers Identit equation.

Well guys and gals I have discovered after all these years that Python does complex numbers without the 'complex()' function or 'cmath' import.
It is well known that Euler's Identity E**(i*pi)+1=0 so I decided to experiment
Code:
Last login: Fri Dec 13 18:27:30 on ttys000
AMIGA:amiga~> python3.8
Python 3.8.0rc1 (v3.8.0rc1:34214de6ab, Oct  1 2019, 12:56:49) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> pi=3.14159265359
>>> e=2.71828182846
>>> 
>>> e**(pi*1j)
(-1-1.31038479358762e-12j)
>>> exit()
 AMIGA:amiga~> _

As you can see within the limitations of the floating point accuracy e**(pi*1j)=-1.
We all live and learn and it also works for Python 1.4.0 for the AMIGA.

Last edited by wisecracker; 12-13-2019 at 03:02 PM.. Reason: Added last two lines.
These 2 Users Gave Thanks to wisecracker For This Post:
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

equation calculation on Unix

Hay, guys, Any ideas how to calculate like this: in first file, there're number of lines listing 2+3, 6*9 ....... Then, how to get the result and put them in another file in format: 2+3 5 6*9 54 ...... sheerly by shell command, no scripts required. (4 Replies)
Discussion started by: robbinGlasses
4 Replies

2. Shell Programming and Scripting

AWK equation evaluation.

Hi, Is there a way to evaluate an equation contained in a string within an AWK script? For example: A = "(5*2)-1" (this equation is read from a file and varies line by line) In this example, I can't see any way to get an answer of 9 unless I do: cmd = "awk 'BEGIN{print "A"}'" cmd |... (3 Replies)
Discussion started by: srdgeo
3 Replies

3. Shell Programming and Scripting

Perl - maths equation - need help

if input to the perl program is ' ( p * ((a+b) * (c+d))) + q ' it shuld give the output as ' pac + pad + pbc + pbd + q ' .can anyone suggest a way to do this ? (7 Replies)
Discussion started by: Anuj8584
7 Replies

4. High Performance Computing

Performance Equation

I'm running a MPI program using a cluster of 4 machines(different machines of different processing power,cpu utilization etc.). I'm trying to balance the computation among the machine to get the minimum execution time for that. I tried to balance it by creating a threshold value by taking the load... (1 Reply)
Discussion started by: chamila1986
1 Replies

5. Shell Programming and Scripting

Help with insert a value equation in bash script

HI All, I have a script in bash that i want that script will perform action When the size of a particular folder exceeds the 80%. Here is an example of script that result is exactly 80% : #!/bin/bash CHECK=$(df -h /var/log/syslog | grep '80%' | xargs echo | cut -d' ' -f5) if ];... (1 Reply)
Discussion started by: Aviel.shani
1 Replies

6. Shell Programming and Scripting

Python fails to detect String Match Found

Below is my code for comparing string for Exact Match found in python. for word in jdbc_trgt.split(','): global comp comp=word.strip(); print "GloBAL:" + comp fiIn = open('list.txt').readlines() for lines in fiIn: print "line1s:" +... (6 Replies)
Discussion started by: mohtashims
6 Replies

7. Shell Programming and Scripting

Assistance with my Find command to identify last part of a file name and report the name found

Hello Forum, We have two bootstraps of Chef in our environment which are identified by colour: /var/chef/cache/cookbooks/bootstrap_cookbooks_version_green and /var/chef/cache/cookbooks/bootstrap_cookbooks_version_red I'm attempting to identify which version is installed based on the name... (11 Replies)
Discussion started by: greavette
11 Replies
PY3COMPILE(1)                                                                                                                        PY3COMPILE(1)

NAME
py3compile - byte compile Python 3 source files SYNOPSIS
py3compile [-V [X.Y][-][A.B]] DIR_OR_FILE [-X REGEXPR] pycompile -p PACKAGE DESCRIPTION
Wrapper around Python standard library's py_compile module to byte-compile Python 3 files. OPTIONS
--version show program's version number and exit -h, --help show this help message and exit -f, --force force rebuild of byte-code files even if timestamps are up-to-date -O byte-compile to .pyo files -q, --quiet be quiet -v, --verbose turn verbose mode on -p PACKAGE, --package=PACKAGE specify Debian package name whose files should be bytecompiled -V VRANGE force private modules to be bytecompiled with Python 3 version from given range, regardless of the default Python 3 version in the system. If there are no other options, bytecompile all public modules for installed Python 3 versions that match given range. VER- SION_RANGE examples: o 3.1 version 3.1 only, o 3.1- version 3.1 or newer, o 3.1-3.3 version 3.1 or 3.2, o -4.0 all supported 3.X versions -X REGEXPR, --exclude=REGEXPR exclude items that match given REGEXPR. You may use this option multiple times to build up a list of things to exclude AUTHOR
Piotr Oarowski, 2012-2013 PY3COMPILE(1)
All times are GMT -4. The time now is 03:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy