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)
import math
def f(x):
return x-0.2*math.sin(x+0.5)
eps=0.001
x=0
delta=2*eps
if f(x)>=0 and f(x+delta)>0:
print('Измените область значений.')
else:
while f(x)*f(x+delta)>0:
x=x+delta
print('x =','{:6.3f}'.format(x+eps))
input()
x^2-20*sin(x)=0 (2)
import math
def f(x1):
return x1**2-20*math.sin(x1)
def f(x2):
return x2**2-20*math.sin(x2)
eps=0.001
x1=0
x2=2
delta=2*eps
if f(x1)>=0 and f(x1+delta)>0:
print('Измените область значений.')
else:
while f(x1)*f(x1+delta)>0:
x1=x1+delta
print('x1 =','{:6.3f}'.format(x1+eps))
if f(x2)>=0 and f(x2+delta)>0:
print('Измените область значений.')
else:
while f(x2)*f(x2+delta)>0:
x2=x2+delta
print('x2 =','{:6.3f}'.format(x2+eps))
input()
x^2-sin(5*x)=0 (3)
import math
def f(x1):
return x1**2-math.sin(5*x1)
def f(x2):
return x2**2-math.sin(5*x2)
def f(x3):
return x3**2-math.sin(5*x3)
def f(x4):
return x4**2-math.sin(5*x4)
eps=0.001
x1=-0.9
x2=-0.8
x3=0
x4=0.5
delta=2*eps
if f(x1)>=0 and f(x1+delta)>0:
print('Измените область значений.')
else:
while f(x1)*f(x1+delta)>0:
x1=x1+delta
print('x1 =','{:6.3f}'.format(x1+eps))
if f(x2)>=0 and f(x2+delta)>0:
print('Измените область значений.')
else:
while f(x2)*f(x2+delta)>0:
x2=x2+delta
print('x2 =','{:6.3f}'.format(x2+eps))
if f(x3)>=0 and f(x3+delta)>0:
print('Измените область значений.')
else:
while f(x3)*f(x3+delta)>0:
x3=x3+delta
print('x3 =','{:6.3f}'.format(x3+eps))
if f(x4)>=0 and f(x4+delta)>0:
print('Измените область значений.')
else:
while f(x4)*f(x4+delta)>0:
x4=x4+delta
print('x4 =','{:6.3f}'.format(x4+eps))
(2,72)^x+x^2=2 (4)
import math
def f(x1):
return 2.72**x1+x1**2-2
def f(x2):
return 2.72**x2+x2**2-2
eps=0.001
x1=-1.3
x2=0.5
delta=2*eps
if f(x1)>=0 and f(x1+delta)>0:
print('Измените область значений.')
else:
while f(x1)*f(x1+delta)>0:
x1=x1+delta
print('x1 =','{:6.3f}'.format(x1+eps))
if f(x2)>=0 and f(x2+delta)>0:
print('Измените область значений.')
else:
while f(x2)*f(x2+delta)>0:
x2=x2+delta
print('x2 =','{:6.3f}'.format(x2+eps))
input()
1,8*x^2-sin(10*x) (5)
import math
def f(x1):
return 1.8*x1**2-math.sin(10*x1)
def f(x2):
return 1.8*x2**2-math.sin(10*x2)
def f(x3):
return 1.8*x3**2-math.sin(10*x3)
eps=0.001
x1=-0.4
x2=0
x3=0.2
delta=2*eps
if f(x1)>=0 and f(x1+delta)>0:
print('Измените область значений.')
else:
while f(x1)*f(x1+delta)>0:
x1=x1+delta
print('x1 =','{:6.3f}'.format(x1+eps))
if f(x2)>=0 and f(x2+delta)>0:
print('Измените область значений.')
else:
while f(x2)*f(x2+delta)>0:
x2=x2+delta
print('x2 =','{:6.3f}'.format(x2+eps))
if f(x3)>=0 and f(x3+delta)>0:
print('Измените область значений.')
else:
while f(x3)*f(x3+delta)>0:
x3=x3+delta
print('x3 =','{:6.3f}'.format(x3+eps))
input()
√(x+1)-1/x=0 (6)
import math
def f(x1):
return (x1+1)**1/2-1/x1
def f(x2):
return (x2+1)**1/2-1/x2
eps=0.001
x1=-3
x2=0.5
delta=2*eps
if f(x1)>=0 and f(x1+delta)>0:
print('Измените область значений.')
else:
while f(x1)*f(x1+delta)>0:
x1=x1+delta
print('x1 =','{:6.3f}'.format(x1+eps))
if f(x2)>=0 and f(x2+delta)>0:
print('Измените область значений.')
else:
while f(x2)*f(x2+delta)>0:
x2=x2+delta
print('x2 =','{:6.3f}'.format(x2+eps))
input()
x-cos(x)=0 (7)
import math
def f(x):
return x-math.cos(x)
eps=0.001
x=0.7
delta=2*eps
if f(x)>=0 and f(x+delta)>0:
print('Измените область значений.')
else:
while f(x)*f(x+delta)>0:
x=x+delta
print('x =','{:6.3f}'.format(x+eps))
input()
(2,72)^-x+x^2=0 (8)
import math
def f(x):
return 2.72**(-x)+x**2
eps=0.001
x=0
delta=2*eps
if f(x)>=0 and f(x+delta)>0:
print('Измените область значений.')
else:
while f(x)*f(x+delta)>0:
x=x+delta
print('x =','{:6.3f}'.format(x+eps))
input()
x^2-cos(x^2)=6 (9)
import math
def f(x1):
return x1**2-math.cos(x1**2)-6
def f(x2):
return x2**2-math.cos(x2**2)-6
eps=0.001
x1=-2.6
x2=2.6
delta=2*eps
if f(x1)>=0 and f(x1+delta)>0:
print('Измените область значений.')
else:
while f(x1)*f(x1+delta)>0:
x1=x1+delta
print('x1 =','{:6.3f}'.format(x1+eps))
if f(x2)>=0 and f(x2+delta)>0:
print('Измените область значений.')
else:
while f(x2)*f(x2+delta)>0:
x2=x2+delta
print('x2 =','{:6.3f}'.format(x2+eps))
input()
√x-2*cos(x)=0 (10)
import math
def f(x1):
return x1**1/2-2*math.cos(x1)
def f(x2):
return x2**1/2-2*math.cos(x2)
def f(x3):
return x3**1/2-2*math.cos(x3)
eps=0.001
x1=-3.6
x2=-2
x3=1.2
delta=2*eps
if f(x1)>=0 and f(x1+delta)>0:
print('Измените область значений.')
else:
while f(x1)*f(x1+delta)>0:
x1=x1+delta
print('x1 =','{:6.3f}'.format(x1+eps))
if f(x2)>=0 and f(x2+delta)>0:
print('Измените область значений.')
else:
while f(x2)*f(x2+delta)>0:
x2=x2+delta
print('x2 =','{:6.3f}'.format(x2+eps))
if f(x3)>=0 and f(x3+delta)>0:
print('Измените область значений.')
else:
while f(x3)*f(x3+delta)>0:
x3=x3+delta
print('x3 =','{:6.3f}'.format(x3+eps))
input()
Половинное деление
x-0,2*sin(x+0,5)=0 (1)
import math
def f(x):
return x-0.2*math.sin(x+0.5)
eps=0.001
a=-5
b=5
delta=2*eps
while b-a>delta:
c=(a+b)/2
if f(a)*f(c)<=0:
b=c
else:
a=c
print('x =', '{:6.3f}'.format((a+b)/2))
x^2-20*sin(x)=0 (2)
import math
def f(x):
return x**2-20*math.sin(x)
eps=0.001
a=-5
b=5
delta=2*eps
while b-a>delta:
c=(a+b)/2
if f(a)*f(c)<=0:
b=c
else:
a=c
print('x =', '{:6.3f}'.format((a+b)/2))
x^2-sin(5*x)=0 (3)
import math
def f(x):
return x**2-math.sin(5*x)
eps=0.001
a=-5
b=5
delta=2*eps
while b-a>delta:
c=(a+b)/2
if f(a)*f(c)<=0:
b=c
else:
a=c
print('x =', '{:6.3f}'.format((a+b)/2))
(2,72)^x+x^2=2 (4)
import math
def f(x):
return 2.72**x+x**2-2
eps=0.001
a=-5
b=5
delta=2*eps
while b-a>delta:
c=(a+b)/2
if f(a)*f(c)<=0:
b=c
else:
a=c
print('x =', '{:6.3f}'.format((a+b)/2))
1,8*x^2-sin(10*x) (5)
import math
def f(x):
return 1.8*x**2-math.sin(10*x)
eps=0.001
a=-5
b=5
delta=2*eps
while b-a>delta:
c=(a+b)/2
if f(a)*f(c)<=0:
b=c
else:
a=c
print('x =', '{:6.3f}'.format((a+b)/2))
√(x+1)-1/x=0 (6)
import math
def f(x):
return (x+1)**1/2-1/x
eps=0.001
a=-2
b=1
delta=2*eps
while b-a>delta:
c=(a+b)/2
if f(a)*f(c)<=0:
b=c
else:
a=c
print('x =', '{:6.3f}'.format((a+b)/2))
x-cos(x)=0 (7)
import math
def f(x):
return x-math.cos(x)
eps=0.001
a=-5
b=5
delta=2*eps
while b-a>delta:
c=(a+b)/2
if f(a)*f(c)<=0:
b=c
else:
a=c
print('x =', '{:6.3f}'.format((a+b)/2))
x^2-cos(x^2)=6 (9)
import math
def f(x):
return x**2-math.cos(x**2)-6
eps=0.001
a=-5
b=5
delta=2*eps
while b-a>delta:
c=(a+b)/2
if f(a)*f(c)<=0:
b=c
else:
a=c
print('x =', '{:6.3f}'.format((a+b)/2))
√x-2*cos(x)=0 (10)
import math
def f(x):
return x**1/2-2*math.cos(x)
eps=0.001
a=-5
b=5
delta=2*eps
while b-a>delta:
c=(a+b)/2
if f(a)*f(c)<=0:
b=c
else:
a=c
print('x =', '{:6.3f}'.format((a+b)/2))
Сортировка массивов
Дан массив 20 целых чисел на отрезке [-2;5]. Упорядочить массив, удалив нули со сдвигом влево, ненулевыми элементами
def mergeSort(A):
if len(A)>1:
mid=len(A)//2
L=A[:mid]
R=A[mid:]
mergeSort(L)
mergeSort(R)
i=j=k=0
while i<len(L) and j<len(R):
if L[i]<R[j]:
A[k]=L[i]
i+=1
else:
A[k]=R[j]
j+=1
k+=1
while i<len(L):
A[k]=L[i]
i+=1
k+=1
while j<len(R):
A[k]=R[j]
j+=1
k+=1
print('Исходный массив:')
from random import randint
N=20
A=[randint(-2,5) for i in range(N)]
print(A)
print('Отсортированный массив:')
mergeSort(A)
i=0
for i in range(N-1,-1,-1):
if A[i]==0:
A.pop(i)
print(A)
Дан массив 15 целых чисел на отрезке [-5;5]. Упорядочить массив, удалив повторяющиеся элементы
def mergeSort(A):
if len(A)>1:
mid=len(A)//2
L=A[:mid]
R=A[mid:]
mergeSort(L)
mergeSort(R)
i=j=k=0
while i<len(L) and j<len(R):
if L[i]<R[j]:
A[k]=L[i]
i+=1
else:
A[k]=R[j]
j+=1
k+=1
while i<len(L):
A[k]=L[i]
i+=1
k+=1
while j<len(R):
A[k]=R[j]
j+=1
k+=1
print('Исходный массив:')
from random import randint
N=20
A=[randint(-2,5) for i in range(N)]
print(A)
print('Отсортированный массив:')
mergeSort(A)
i=0
for i in range(N-1,-1,-1):
if A[i]==0:
A.pop(i)
print(A)
![]() |
Notes is a web-based application for online 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 14 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