Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. import math
  2. def fel1():
  3. print("adjon meg a szog merteket:", end = "\n")
  4. a= float(input())
  5. rad = math.radians(a)
  6. print(rad)
  7. #fel1()
  8.  
  9. def fel2():
  10. print("adjon meg egy radian merteket:",end="\n")
  11. a=float(input())
  12. print(math.degrees(a))
  13. #fel2()
  14.  
  15. def fel3(a1,a2,h):
  16. T = ((a1+a2)/2)*h
  17. print(T)
  18. #fel3(5,6,5)
  19.  
  20. def fel4(a,h):
  21. T = a*h
  22. print(T)
  23. #fel4(5,6)
  24.  
  25. def fel5():
  26. print("Adjon meg egy szamot", end = "\n")
  27. a = int(input())
  28. sum = 0
  29. for i in range(1,a):
  30. if a % i == 0:
  31. sum = sum + i
  32. print(sum)
  33. return sum
  34. #fel5()
  35.  
  36. def fel6():
  37. print("Adja meg az X koordinatait a 3D terben", end=" ")
  38. x1 = int(input())
  39. x2 = int(input())
  40. x3 = int(input())
  41. print("Adja meg az Y koordinatait a 3D terben", end=" ")
  42. y1 = int(input())
  43. y2 = int(input())
  44. y3 = int(input())
  45. tav = math.sqrt((x1-y1)**2+(x2-y2)**2+(x3-y3)**2)
  46. print(tav)
  47. #fel6()
  48.  
  49. def fel7():
  50. print("Adja meg a ter dimenziojat:",end=" ")
  51. n = int(input())
  52. L = []
  53. K= []
  54. for i in range(2):
  55. print("Adja meg az ",i+1,"pont koordinatait",end="\n")
  56. for j in range(n):
  57. if i == 0:
  58. a = int(input())
  59. L.append(a)
  60. if i ==1:
  61. a = int(input())
  62. K.append(a)
  63. tav = 0
  64. for i in range(n):
  65. tav += (K[i]-L[i])**2
  66. print(math.sqrt(tav))
  67.  
  68. #fel7()
  69. def fel8(L):
  70. L.reverse()
  71. print(L)
  72. #fel8([1,2,3]
  73. def fel9(bef1,bef2,atf):
  74. if atf**2 == bef1**2+bef2**2:
  75. print("Igaz")
  76. return True
  77. print("Hamis")
  78. return False
  79. #fel9(3,4,5)
  80. def fel10(x1,y1,x2,y2):
  81. print("Adja meg a pont kordinatait:",end="\n")
  82. x = int(input())
  83. y = int(input())
  84. if (x-x1) * (y2-y1) == (x2-x1)*(y-y1):
  85. print("Rajta van")
  86. else:
  87. print("Nincs rajta")
  88. #fel10(2,3,3,4)
  89. import matplotlib.pyplot as plt
  90.  
  91. def fel11(x,y):
  92. plt.plot(x,y,'ro')
  93. #plt.plot(x,y)
  94. plt.xlabel("X")
  95. plt.ylabel("Y")
  96. plt.title("D.K.R")
  97. plt.show()
  98. #fel11([1,4],[8,1],)
  99. import numpy as np
  100. def fel12():
  101. fugv1 = np.arange(-4.,3,0.2)
  102. plt.xlabel("X")
  103. plt.ylabel("Y")
  104. plt.title("D.K.R")
  105. plt.plot(fugv1,fugv1,"r--",fugv1,fugv1**2,"bs",fugv1,fugv1**3,"g^")
  106. plt.show()
  107. #fel12()
  108.  
  109. def fel13():
  110. x = np.arange(0, 4*np.pi, 0.1)
  111. y = np.sin(2*x)
  112. plt.plot(x,y)
  113. plt.show()
  114.  
  115. #fel13()
  116. def fel14():
  117. k = np.sin(np.pi/6)
  118. print(round(k))
  119. #fel14()
  120.  
  121. def fel15(L):
  122. Y = []
  123. a = len(L)
  124. e= 2.71
  125. for i in range(a):
  126. b = math.sin(L[i])+math.cos(L[i])
  127. nev = e**L[i]
  128. Y.append(b/nev)
  129. plt.plot(L,Y,"bs")
  130. plt.show()
  131. #fel15([1,2,3])
  132.  
  133.  
  134.  
  135. def HF1():
  136. x = np.arange(-1,0,0.2)
  137. plt.plot(x,x+1)
  138. neg = np.arange(-2,-1,0.2)
  139. plt.plot(neg,neg+1,color = "red")
  140. plt.show()
  141. #HF1()
  142. def HF2():
  143. x = np.arange(0, 4 * np.pi, 0.1)
  144. y = np.sin(x)
  145. plt.plot(x, y)
  146. fugv1 = np.arange(-2,2,0.2)
  147. plt.plot(fugv1,fugv1**2-1,color = "red")
  148. plt.show()
  149. #HF2()
  150.  
  151. def HF3():
  152. A = [1,3,2]
  153. B= [1,1,2.73]
  154. plt.plot(A,B,"bs")
  155. plt.show()
  156. #HF3()
  157. def HF4():
  158. kor = plt.Circle((0,0),3,color="red",fill=False)
  159. fig, ax = plt.subplots()
  160. plt.xlim(-5, 5)
  161. plt.ylim(-5, 5)
  162. ax.set_aspect(1)
  163.  
  164. ax.add_artist(kor)
  165. plt.show()
  166. #HF4()
  167.  
  168.  
  169. def HF5():
  170. x = np.arange(-1,1,0.1)
  171. L = []
  172. for num in x:
  173. L.append(math.log(num**2,math.e))
  174. plt.plot(x,L)
  175. plt.show()
  176. #HF5()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement