0

I am a Python beginner, and I have the following problem: I have a set of values between 0 and 1, and I want to implement a nonlinear function that outputs values between 0 and 100 as follows:

enter image description here

(Sorry for the lack of mathematical description of this function, I'm not sure how it's called - the curve is essentially a quarter of a circle)

I feel like this should be very straightforward, but I'm at a loss about how to proceed.

Many thanks in advance!

Paul Miller
  • 493
  • 1
  • 5
  • 13

1 Answers1

1

The equation you are looking for is

sqrt(100**2 - 100**2(x-1)**2)

As such:

arr = np.random.random_sample(100) #100 numbers between 0 and 1
hyp = lambda x: (100**2 - 100**2*(x-1)**2)**0.5
print(hyp(arr)) #[98.18880326, 68.95051961, 98.81540216, 26.98951239...]
A.J. Uppal
  • 19,117
  • 6
  • 45
  • 76