loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.9755179457481542","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IG51bXB5IGFzIG5wCgp4ID0gbnAuYXJyYXkoW1sxLDJdLFszLDRdXSwgZHR5cGU9bnAuZmxvYXQ2NCkKeSA9IG5wLmFycmF5KFtbNSw2XSxbNyw4XV0sIGR0eXBlPW5wLmZsb2F0NjQpCgojIEVsZW1lbnR3aXNlIHN1bTsgYm90aCBwcm9kdWNlIHRoZSBhcnJheQojIFtbIDYuMCAgOC4wXQojICBbMTAuMCAxMi4wXV0KcHJpbnQoeCArIHkpCnByaW50KG5wLmFkZCh4LCB5KSkKCiMgRWxlbWVudHdpc2UgZGlmZmVyZW5jZTsgYm90aCBwcm9kdWNlIHRoZSBhcnJheQojIFtbLTQuMCAtNC4wXQojICBbLTQuMCAtNC4wXV0KcHJpbnQoeCAtIHkpCnByaW50KG5wLnN1YnRyYWN0KHgsIHkpKQoKIyBFbGVtZW50d2lzZSBwcm9kdWN0OyBib3RoIHByb2R1Y2UgdGhlIGFycmF5CiMgW1sgNS4wIDEyLjBdCiMgIFsyMS4wIDMyLjBdXQpwcmludCh4ICogeSkKcHJpbnQobnAubXVsdGlwbHkoeCwgeSkpCgojIEVsZW1lbnR3aXNlIGRpdmlzaW9uOyBib3RoIHByb2R1Y2UgdGhlIGFycmF5CiMgW1sgMC4yICAgICAgICAgMC4zMzMzMzMzM10KIyAgWyAwLjQyODU3MTQzICAwLjUgICAgICAgXV0KcHJpbnQoeCAvIHkpCnByaW50KG5wLmRpdmlkZSh4LCB5KSkKCiMgRWxlbWVudHdpc2Ugc3F1YXJlIHJvb3Q7IHByb2R1Y2VzIHRoZSBhcnJheQojIFtbIDEuICAgICAgICAgIDEuNDE0MjEzNTZdCiMgIFsgMS43MzIwNTA4MSAgMi4gICAgICAgIF1dCnByaW50KG5wLnNxcnQoeCkp"},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import numpy as np

x = np.array([[1,2],[3,4]], dtype=np.float64)
y = np.array([[5,6],[7,8]], dtype=np.float64)

# Elementwise sum; both produce the array
# [[ 6.0  8.0]
#  [10.0 12.0]]
print(x + y)
print(np.add(x, y))

# Elementwise difference; both produce the array
# [[-4.0 -4.0]
#  [-4.0 -4.0]]
print(x - y)
print(np.subtract(x, y))

# Elementwise product; both produce the array
# [[ 5.0 12.0]
#  [21.0 32.0]]
print(x * y)
print(np.multiply(x, y))

# Elementwise division; both produce the array
# [[ 0.2         0.33333333]
#  [ 0.42857143  0.5       ]]
print(x / y)
print(np.divide(x, y))

# Elementwise square root; produces the array
# [[ 1.          1.41421356]
#  [ 1.73205081  2.        ]]
print(np.sqrt(x))