Advertisement
Guest User

Untitled

a guest
Mar 9th, 2015
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. from scipy import *
  2. from numpy import *
  3. from random import*
  4. q=complex(2,0)
  5. w=complex(-2,0)
  6. e=complex(0,-2)
  7.  
  8. vas=complex(0,0)
  9.  
  10. def f(a,b,c):
  11. return ((b-c)*(abs(a)**2.0) + (c-a)*(abs(b)**2.0) + (a-b)*(abs(c)**2.0))/(((b-c)*(conj(a)) + ((c-a)*conj(b)) + ((a-b)*conj(c))))
  12.  
  13. print "Test:", f(q,w,e),"\n"
  14.  
  15. for i in range(1,10):
  16. h11=randint(0,360)
  17. h11=h11* pi/180
  18. h1= cos(h11)
  19. j1= sin(h11)
  20. a=complex(h1,j1)
  21.  
  22. h22=randint(0,360)
  23. h22= h22* pi/180
  24. h2= cos(h22)
  25. j2= sin(h22)
  26. b=complex(h2,j2)
  27.  
  28. h33=randint(0,360)
  29. h33=h33* pi/180
  30. h3= cos(h33)
  31. j3= sin(h33)
  32. c=complex(h3,j3)
  33.  
  34. print "Points:","a:",a,"b:",b,"c:",c
  35. print "Function value:",f(a,b,c)
  36. print "-------------------------------------------------------------------"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement