Нахождение всех действительных корней алгебраического многочлена методом деления отрезка пополам (би...
Курсовой проект - Математика и статистика
Другие курсовые по предмету Математика и статистика
uot;m5").Value) + (x ^ 4 * Range("m4").Value) + (x ^ 3 * Range("m3").Value) + (x ^ 2 * Range("m2").Value) + (x * Range("m1").Value) + Range("m21").Value
End Function
Public Sub Gra()
Sheets("Лист1").Select
Range("e1").Select
For i = -10 To 10
ActiveCell.Value = F(i)
ActiveCell.Cells(2).Select
Next i
End Sub
Public Function DetectBorders()
Функция определения границ действительных корней
ma = 0
For Each curcell In Range("Koeffs")
maThenma=curcell.Value"> If curcell.Value > ma Then ma = curcell.Value
0ThenAo=curcell.Value"> If curcell.Value <> 0 Then Ao = curcell.Value
Next curcell
DetectBorders = 1 + (ma * Ao)
End Function
UNIT2
Sub auto_open()
Sheets("Лист1").Select
Form_Main.Show
End Sub
FORM_ABOUT
Private Sub CommandButton1_Click()
Form_About.Hide
End Sub
FORM_KOEFF
Private Sub CommandButton1_Click()
ko = TextBox1.Value
st = TextBox2.Value
Select Case st
Case 0
Range("A21").Value = ko
Case 1
Range("A1") = ko
Case 2
Range("A2") = ko
Case 3
Range("A3") = ko
Case 4
Range("A4") = ko
Case 5
Range("A5") = ko
Case 6
Range("A6") = ko
Case 7
Range("A7") = ko
Case 8
Range("A8") = ko
Case 9
Range("A9") = ko
Case 10
Range("A10") = ko
Case 11
Range("A11") = ko
Case 12
Range("A12") = ko
Case 13
Range("A13") = ko
Case 14
Range("A14") = ko
Case 15
Range("A15") = ko
Case 16
Range("A16") = ko
Case 17
Range("A17") = ko
Case 18
Range("A18") = ko
Case 19
Range("A19") = ko
Case 20
Range("A20") = ko
Case Else
MsgBox ("Выход за пределы допустимых значений")
st = st - 1
End Select
TextBox1.Value = 0
TextBox2.Value = st + 1
End Sub
Private Sub CommandButton2_Click()
Form_Koeff.Hide
End Sub
Private Sub CommandButton3_Click()
Range("a1").Value = 0
Range("a2").Value = 0
Range("a3").Value = 0
Range("a4").Value = 0
Range("a5").Value = 0
Range("a6").Value = 0
Range("a7").Value = 0
Range("a8").Value = 0
Range("a9").Value = 0
Range("a10").Value = 0
Range("a11").Value = 0
Range("a12").Value = 0
Range("a13").Value = 0
Range("a14").Value = 0
Range("a15").Value = 0
Range("a16").Value = 0
Range("a17").Value = 0
Range("a18").Value = 0
Range("a19").Value = 0
Range("a20").Value = 0
Range("a21").Value = 0
End Sub
Private Sub UserForm_initialize()
st = 0
ko = 0
TextBox1.Value = ko
TextBox2.Value = st
End Sub
FORM_KORNI
Private Sub CommandButton1_Click()
ListBox1.Clear
TextBox1.Value = 0
Form_Korni.Hide
End Sub
Private Sub CommandButton2_Click()
Range("Toc").Value = TextBox1.Value
Call FindKor
Call Perenos
End Sub
Sub FindKor()
Range("Curright") = Range("Right").Value
Range("Curleft") = -Range("Right").Value - 0.333
Range("right").Value = DetectBorders
Range("Stepleft").Value = Range("right").Value * (-1) - 0.333
Do
nashli = False
Call MoveLe
If Sgn(F(Range("curleft").Value)) = Sgn(F(Range("curright").Value)) Then
End If
If Sgn(F(Range("curleft").Value)) <> Sgn(F(Range("curright").Value)) Then
Do
nashli = True
Range("Curcenter").Value = ((Range("curleft").Value) + (Range("curright").Value)) / 2
If Abs(F(Range("Curcenter").Value)) > Range("toc").Value Then If Sgn(F(Range("curleft").Value)) <> Sgn(F(Range("curcenter").Value)) Then Range("curright").Value = Range("curcenter").Value Else: Range("curleft").Value = Range("curcenter").Value
If Abs(F(Range("Curcenter").Value)) <= Range("toc").Value Then ListBox1.AddItem (Range("Curcenter").Value)
Range("Koren").Value = Range("Curcenter").Value
Loop Until Abs(F(Range("Curcenter").Value)) <= Range("toc").Value
End If
Loop Until Range("Stepleft").Value > Range("right").Value Or nashli = True
End Sub
Sub Horda_Kas()
Sub FindKor()
Range("Curright") = Range("Right").Value
Range("Curleft") = -Range("Right").Value - 0.333
Range("right").Value = DetectBorders
Range("Stepleft").Value = Range("right").Value * (-1) - 0.333
Do
MoveLe
If Sgn(F(Range("curleft").Value)) <> Sgn(F(Range("curright").Value)) Then
Do
nashli = True
If F1(Range("curleft").Value) * F2(Range("curleft").Value) > 0 Then
Range("curleft").Value = Range("curleft").Value - ((Range("curright").Value - Range("curleft").Value) * (F(Range("Curleft").Value) / (F(Range("Curright").Value - F(Range("Curleft").Value)))))
Range("Curright").Value = Range("curright").Value - F(Range("curright").Value) / F1(Range("curright").Value)
End If
If F1(Range("curleft").Value) * F2(Range("curleft").Value) < 0 Then
Range("curright").Value = Range("curleft").Value - ((Range("curright").Value - Range("curleft").Value) * (F(Range("Curleft").Value) / (F(Range("Curright").Value - F(Range("Curleft").Value)))))
Range("Curleft").Value = Range("curright").Value - F(Range("curright").Value) / F1(Range("curright").Value)
End If
If Abs(Abs(F(Range("Curright").Value))) - Abs(F(Range("Curleft").Value)) <= Range("toc").Value Then
MsgBox (Range("curleft").Value)
ListBox1.AddItem (Range("Curright").Value)
0ThenListBox1.AddItem(((Range("Curleft").Value)+(Range("Curright").Value))/2)"> If ((Range("Curleft").Value) + (Range("Curright").Value)) > 0 Then ListBox1.AddItem (((Range("Curleft").Value) + (Range("Curright").Value)) / 2)
If ((Range("Curleft").Value) + (Range("Curright").Value)) < 0 Then ListBox1.AddItem (((Range("Curleft").Value) + (Range("Curright").Value)) / 2)
Range("Koren").Value = Range("Curleft").Value
End If
Loop Until Abs(F(Range("Curright").Value)) - Abs(F(Range("Curleft").Value)) <= Range("toc").Value
End If
Loop Until Range("Stepleft").Value > Range("right").Value Or nashli = True
End Sub
Sub MoveLe()
Range("stepleft").Value = Range("stepleft").Value + 0.333
Range("curLeft").Value = Range("stepleft").Value
Range("Curright").Value = Range("Curleft").Value + 0.333
Range("Curcenter").Value = ((Range("curleft").Value) + (Range("curright&