Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
x-0,2*sin(x+0,5)=0 (1)
1 import math
1 def f(x):
2 return x-0.2*math.sin(x+0.5)
1 eps=0.001
1 x=0
1 delta=2*eps
1 if f(x)>=0 and f(x+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x)*f(x+delta)>0:
3 x=x+delta
2 print('x =','{:6.3f}'.format(x+eps))
1 input()
x^2-20*sin(x)=0 (2)
1 import math
1 def f(x1):
2 return x1**2-20*math.sin(x1)
1 def f(x2):
2 return x2**2-20*math.sin(x2)
1 eps=0.001
1 x1=0
1 x2=2
1 delta=2*eps
1 if f(x1)>=0 and f(x1+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x1)*f(x1+delta)>0:
3 x1=x1+delta
2 print('x1 =','{:6.3f}'.format(x1+eps))
1 if f(x2)>=0 and f(x2+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x2)*f(x2+delta)>0:
3 x2=x2+delta
2 print('x2 =','{:6.3f}'.format(x2+eps))
1 input()
x^2-sin(5*x)=0 (3)
1 import math
1 def f(x1):
2 return x1**2-math.sin(5*x1)
1 def f(x2):
2 return x2**2-math.sin(5*x2)
1 def f(x3):
2 return x3**2-math.sin(5*x3)
1 def f(x4):
2 return x4**2-math.sin(5*x4)
1 eps=0.001
1 x1=-0.9
1 x2=-0.8
1 x3=0
1 x4=0.5
1 delta=2*eps
1 if f(x1)>=0 and f(x1+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x1)*f(x1+delta)>0:
3 x1=x1+delta
2 print('x1 =','{:6.3f}'.format(x1+eps))
1 if f(x2)>=0 and f(x2+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x2)*f(x2+delta)>0:
3 x2=x2+delta
2 print('x2 =','{:6.3f}'.format(x2+eps))
1 if f(x3)>=0 and f(x3+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x3)*f(x3+delta)>0:
3 x3=x3+delta
2 print('x3 =','{:6.3f}'.format(x3+eps))
1 if f(x4)>=0 and f(x4+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x4)*f(x4+delta)>0:
3 x4=x4+delta
2 print('x4 =','{:6.3f}'.format(x4+eps))
(2,72)^x+x^2=2 (4)
1 import math
1 def f(x1):
2 return 2.72**x1+x1**2-2
1 def f(x2):
2 return 2.72**x2+x2**2-2
1 eps=0.001
1 x1=-1.3
1 x2=0.5
1 delta=2*eps
1 if f(x1)>=0 and f(x1+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x1)*f(x1+delta)>0:
3 x1=x1+delta
2 print('x1 =','{:6.3f}'.format(x1+eps))
1 if f(x2)>=0 and f(x2+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x2)*f(x2+delta)>0:
3 x2=x2+delta
2 print('x2 =','{:6.3f}'.format(x2+eps))
1 input()
1,8*x^2-sin(10*x) (5)
1 import math
1 def f(x1):
2 return 1.8*x1**2-math.sin(10*x1)
1 def f(x2):
2 return 1.8*x2**2-math.sin(10*x2)
1 def f(x3):
2 return 1.8*x3**2-math.sin(10*x3)
1 eps=0.001
1 x1=-0.4
1 x2=0
1 x3=0.2
1 delta=2*eps
1 if f(x1)>=0 and f(x1+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x1)*f(x1+delta)>0:
3 x1=x1+delta
2 print('x1 =','{:6.3f}'.format(x1+eps))
1 if f(x2)>=0 and f(x2+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x2)*f(x2+delta)>0:
3 x2=x2+delta
2 print('x2 =','{:6.3f}'.format(x2+eps))
1 if f(x3)>=0 and f(x3+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x3)*f(x3+delta)>0:
3 x3=x3+delta
2 print('x3 =','{:6.3f}'.format(x3+eps))
1 input()
√(x+1)-1/x=0 (6)
1 import math
1 def f(x1):
2 return (x1+1)**1/2-1/x1
1 def f(x2):
2 return (x2+1)**1/2-1/x2
1 eps=0.001
1 x1=-3
1 x2=0.5
1 delta=2*eps
1 if f(x1)>=0 and f(x1+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x1)*f(x1+delta)>0:
3 x1=x1+delta
2 print('x1 =','{:6.3f}'.format(x1+eps))
1 if f(x2)>=0 and f(x2+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x2)*f(x2+delta)>0:
3 x2=x2+delta
2 print('x2 =','{:6.3f}'.format(x2+eps))
1 input()
x-cos(x)=0 (7)
1 import math
1 def f(x):
2 return x-math.cos(x)
1 eps=0.001
1 x=0.7
1 delta=2*eps
1 if f(x)>=0 and f(x+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x)*f(x+delta)>0:
3 x=x+delta
2 print('x =','{:6.3f}'.format(x+eps))
1 input()
(2,72)^-x+x^2=0 (8)
1 import math
1 def f(x):
2 return 2.72**(-x)+x**2
1 eps=0.001
1 x=0
1 delta=2*eps
1 if f(x)>=0 and f(x+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x)*f(x+delta)>0:
3 x=x+delta
2 print('x =','{:6.3f}'.format(x+eps))
1 input()
x^2-cos(x^2)=6 (9)
1 import math
1 def f(x1):
2 return x1**2-math.cos(x1**2)-6
1 def f(x2):
2 return x2**2-math.cos(x2**2)-6
1 eps=0.001
1 x1=-2.6
1 x2=2.6
1 delta=2*eps
1 if f(x1)>=0 and f(x1+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x1)*f(x1+delta)>0:
3 x1=x1+delta
2 print('x1 =','{:6.3f}'.format(x1+eps))
1 if f(x2)>=0 and f(x2+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x2)*f(x2+delta)>0:
3 x2=x2+delta
2 print('x2 =','{:6.3f}'.format(x2+eps))
1 input()
√x-2*cos(x)=0 (10)
1 import math
1 def f(x1):
2 return x1**1/2-2*math.cos(x1)
1 def f(x2):
2 return x2**1/2-2*math.cos(x2)
1 def f(x3):
2 return x3**1/2-2*math.cos(x3)
1 eps=0.001
1 x1=-3.6
1 x2=-2
1 x3=1.2
1 delta=2*eps
1 if f(x1)>=0 and f(x1+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x1)*f(x1+delta)>0:
3 x1=x1+delta
2 print('x1 =','{:6.3f}'.format(x1+eps))
1 if f(x2)>=0 and f(x2+delta)>0:
2 print('Измените область значений.')
1 else:
1 while f(x2)*f(x2+delta)>0:
3 x2=x2+delta
2 print('x2 =','{:6.3f}'.format(x2+eps))
1 if f(x3)>=0 and f(x3+delta)>0:
2 print('Измените область значений.')
1 else:
2 while f(x3)*f(x3+delta)>0:
3 x3=x3+delta
2 print('x3 =','{:6.3f}'.format(x3+eps))
1 input()
Половинное деление
x-0,2*sin(x+0,5)=0 (1)
1 import math
1 def f(x):
2 return x-0.2*math.sin(x+0.5)
1 eps=0.001
1 a=-5
1 b=5
1 delta=2*eps
1 while b-a>delta:
2 c=(a+b)/2
2 if f(a)*f(c)<=0:
3 b=c
2 else:
3 a=c
1 print('x =', '{:6.3f}'.format((a+b)/2))
x^2-20*sin(x)=0 (2)
1 import math
1 def f(x):
2 return x**2-20*math.sin(x)
1 eps=0.001
1 a=-5
1 b=5
1 delta=2*eps
1 while b-a>delta:
2 c=(a+b)/2
2 if f(a)*f(c)<=0:
3 b=c
2 else:
3 a=c
1 print('x =', '{:6.3f}'.format((a+b)/2))
x^2-sin(5*x)=0 (3)
1 import math
1 def f(x):
2 return x**2-math.sin(5*x)
1 eps=0.001
1 a=-5
1 b=5
1 delta=2*eps
1 while b-a>delta:
2 c=(a+b)/2
2 if f(a)*f(c)<=0:
3 b=c
2 else:
3 a=c
1 print('x =', '{:6.3f}'.format((a+b)/2))
(2,72)^x+x^2=2 (4)
1 import math
1 def f(x):
2 return 2.72**x+x**2-2
1 eps=0.001
1 a=-5
1 b=5
1 delta=2*eps
1 while b-a>delta:
2 c=(a+b)/2
2 if f(a)*f(c)<=0:
3 b=c
2 else:
3 a=c
1 print('x =', '{:6.3f}'.format((a+b)/2))
1,8*x^2-sin(10*x) (5)
1 import math
1 def f(x):
2 return 1.8*x**2-math.sin(10*x)
1 eps=0.001
1 a=-5
1 b=5
1 delta=2*eps
1 while b-a>delta:
2 c=(a+b)/2
2 if f(a)*f(c)<=0:
3 b=c
2 else:
3 a=c
1 print('x =', '{:6.3f}'.format((a+b)/2))
√(x+1)-1/x=0 (6)
1 import math
1 def f(x):
2 return (x+1)**1/2-1/x
1 eps=0.001
1 a=-2
1 b=1
1 delta=2*eps
1 while b-a>delta:
2 c=(a+b)/2
2 if f(a)*f(c)<=0:
3 b=c
2 else:
3 a=c
1 print('x =', '{:6.3f}'.format((a+b)/2))
x-cos(x)=0 (7)
1 import math
1 def f(x):
2 return x-math.cos(x)
1 eps=0.001
1 a=-5
1 b=5
1 delta=2*eps
1 while b-a>delta:
2 c=(a+b)/2
2 if f(a)*f(c)<=0:
3 b=c
2 else:
3 a=c
1 print('x =', '{:6.3f}'.format((a+b)/2))
x^2-cos(x^2)=6 (9)
1 import math
1 def f(x):
2 return x**2-math.cos(x**2)-6
1 eps=0.001
1 a=-5
1 b=5
1 delta=2*eps
1 while b-a>delta:
2 c=(a+b)/2
2 if f(a)*f(c)<=0:
3 b=c
2 else:
3 a=c
1 print('x =', '{:6.3f}'.format((a+b)/2))
√x-2*cos(x)=0 (10)
1 import math
1 def f(x):
2 return x**1/2-2*math.cos(x)
1 eps=0.001
1 a=-5
1 b=5
1 delta=2*eps
1 while b-a>delta:
2 c=(a+b)/2
2 if f(a)*f(c)<=0:
3 b=c
2 else:
3 a=c
1 print('x =', '{:6.3f}'.format((a+b)/2))
Сортировка массивов
Дан массив 20 целых чисел на отрезке [-2;5]. Упорядочить массив, удалив нули со сдвигом влево, ненулевыми элементами
1 def mergeSort(A):
2 if len(A)>1:
3 mid=len(A)//2
3 L=A[:mid]
3 R=A[mid:]
3 mergeSort(L)
3 mergeSort(R)
3 i=j=k=0
3 while i<len(L) and j<len(R):
4 if L[i]<R[j]:
5 A[k]=L[i]
5 i+=1
4 else:
5 A[k]=R[j]
5 j+=1
4 k+=1
3 while i<len(L):
4 A[k]=L[i]
4 i+=1
4 k+=1
3 while j<len(R):
4 A[k]=R[j]
4 j+=1
4 k+=1
1 print('Исходный массив:')
1 from random import randint
1 N=20
1 A=[randint(-2,5) for i in range(N)]
1 print(A)
1 print('Отсортированный массив:')
1 mergeSort(A)
1 i=0
1 for i in range(N-1,-1,-1):
2 if A[i]==0:
3 A.pop(i)
1 print(A)
Дан массив 15 целых чисел на отрезке [-5;5]. Упорядочить массив, удалив повторяющиеся элементы
1 def mergeSort(A):
2 if len(A)>1:
3 mid=len(A)//2
3 L=A[:mid]
3 R=A[mid:]
3 mergeSort(L)
3 mergeSort(R)
3 i=j=k=0
3 while i<len(L) and j<len(R):
4 if L[i]<R[j]:
5 A[k]=L[i]
5 i+=1
4 else:
5 A[k]=R[j]
5 j+=1
4 k+=1
3 while i<len(L):
4 A[k]=L[i]
4 i+=1
4 k+=1
3 while j<len(R):
4 A[k]=R[j]
4 j+=1
4 k+=1
1 print('Исходный массив:')
1 from random import randint
1 N=20
1 A=[randint(-2,5) for i in range(N)]
1 print(A)
1 print('Отсортированный массив:')
1 mergeSort(A)
1 i=0
1 for i in range(N-1,-1,-1):
2 if A[i]==0:
3 A.pop(i)
1 print(A)
![]() |
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team