Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- import numpy as np
- import matplotlib.pyplot as plt
- def f(z):
- if z <= 0:
- return 0
- elif z >= 1:
- return 1
- else:
- return math.exp(-1/(z*z) + 1)
- x = np.linspace(0.0, 1.0, 10)
- y = np.vectorize(f)(x)
- print(np.vectorize(f)(x[1:10]))
- print(np.vectorize(f)(x))
- # Вывод
- [ 1.80485139e-35 4.36346225e-09 3.35462628e-04 1.72059504e-02
- 1.06458504e-01 2.86504797e-01 5.20450121e-01 7.66726596e-01
- 1.00000000e+00]
- [0 0 0 0 0 0 0 0 0 1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement