title: Python Curve Shifiting
body: <p>I want to shift the green curve below upward (or downward) along Y-axis depending on a given P1 point at day 4. I would like to know how I can do that in order to predict a P2 point, based on the original curve if it was shifted.   </p>
  
  <p>I know that the green curve has the formula: </p>
  
  <p><code>0.000371 x^3 - 0.01274 x^2 + 0.1428 x - 0.02804</code></p>
  
  <p>I need to solve two points:</p>
  
  <p><strong>1 - How to shift the green curve based on P1.</strong></p>
  
  <p><strong>2 - Calculate P2 as a projection of the green curved shifted.</strong></p>
  
  <p><a href="https://i.stack.imgur.com/5u5Bc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5u5Bc.png" alt="enter image description here"></a></p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  x = [1, 2, 3, 4, 5,6,7,8,9,10,11,12,13,14,15,16,17]
  y = [0.1,0.2,0.3,0.38,0.41,0.46,0.475,0.478,0.486,0.489,0.493,0.49,0.495,0.498,0.511,0.5124,0.53]
  plt.plot(x, y, 'x-')
  
  # calculate polynomial
  z = np.polyfit(x, y, 3)
  f = np.poly1d(z)
  
  # calculate new x's and y's
  x_new = np.linspace(x[0], x[-1], 50)
  y_new = f(x_new)
  
  plt.plot(x,y,'o', label='original data')
  plt.plot(x_new, y_new, label='fitted line')
  plt.legend()
  plt.show()
  
  print(f)
  
  
  # function to be defined :
  p1 = 0.38 
  p2 = findP2(f,p1) # to build
  print(p2) 
  </code></pre>
  
  <p>I hope someone can help me, please! </p>
  
  <p>:)</p>
  
  <p>Thank you!</p>