title: Python: straight line, Slope k is known, one point P1 is known, length P1P2 is known, how to get P2?
body: <p>For a straight line, Slope k is known, one point(x1,y1) is know, how to get the other point (x2,y2) using python?
  I know the way to do calculation, but have no idea to code using python.</p>
  
  <ol>
  <li>(y2-y1)/(x2-x1)=k</li>
  <li>sqrt((x2-x1)^2+(y2-y1)^2)= length</li>
  </ol>
  
  <p>if two unknown equations, both two variables with power 1, linalg-solve should work, but now the power of 2rd function is 2, how to deal with that?</p>
  
  <p>I tried to simplify as following, but seems I cannot apply linalg-solve</p>
  
  <ol>
  <li>kx2-y2-kx1+y1 = 0</li>
  <li>(y2-y1)^2 + (x2-x1)^2 = length^2</li>
  </ol>
  
  <p><strong>Supplement：</strong>
  thanks to all of your answer...Posh_Pumpkin's code is exactly what I want, previously I thought I need to apply linalg-solve which I usually use. </p>
  
  <p>here is a test code based on his answer:suppose P1 = (1,1) p2=(x,y), p1p2= sqrt(2), k=1,then p2 must be = (2,2)</p>
  
  <pre><code>import numpy as np
  import math
  k = 1
  d = math.sqrt(2)
  p1 = (1,1)
  r_sq = d**2 / (1 + k**2)
  r = math.sqrt(r_sq)
  p2 = (p1[0] + r, p1[1] + k*r)
  print(p2)
  </code></pre>