Смекни!
smekni.com

НАХОЖДЕНИЕ ВСЕХ ДЕЙСТВИТЕЛЬНЫХ КОРНЕЙ АЛГЕБРАИЧЕСКОГО МНОГОЧЛЕНА МЕТОДОМ ДЕЛЕНИЯ ОТРЕЗКА ПОПОЛАМ (БИСЕКЦИИ) И МЕТОДОМ ХОРД И КАСАТЕЛЬНЫХ С УКАЗАННОЙ ТОЧНОСТЬЮ И УЧЕТОМ ВОЗМОЖНОЙ КРАТНОСТИ КОРНЕЙ (стр. 3 из 4)

СОХРАНИТЬ СъFраЃEет файл со всемЃEсделаныZЃE изЃEыDыGяЃE
ПРОСМОТР ФУНКЦИИ ВывьCит ъь эЃEан ьIыM, ЃEЃEтороЃEъCь@ражаетЃE виЃE ЃEьBъHЃEъь, ЃEтаЃEЃEвиЃEЃEьGзвьCыZЃEЃEрвьBЃEЃEвтъAьBЃEЃEЃEдкьA (ВыбъA ъBужествЃEетЃE ъьжатием ЃEъ@ьI FЃEX), FЃEX), F(X)
ВВОД КОЭФФИЦИЕНТОВ ВывьCит ъь эЃEан ьIыM ввьCЃEЃEэффициеыQьA
ГРАФИК ВывьCит график фуыIциЃE/td>
ПОИСК КОРНЕЙ ОтображаеЃEьIыM, управляющеЃEЃEисЃEЃEЃEрней
О ПРОГРАММЕ ВывьCит ьIыM «О ЃEьBраЃEе»
ВЫХОД Завершает работу ЃEьBраЃE, ЃEедваритеЃEыMзадавая воЃEъB ЃE сохранении изЃEыDыGЃE/td>

ВвоЃEЃEэффициеыQьA ъBуществЃEетЃE следЃEщиЃEь@разоЃE ЃE ЃEявившемЃE ьIыD имЃEтся 2 ЃEЃE ЃEьCыM для указанЃE степенЃE другьD для ввьCЃE собственыM ЃEэффициеыQЃE ЕслЃEВЃEужЃEввьCилЃEыDЃEторую фуыIцию, то для ее удаленЃE ъьжмитЃEЃEъ@ЃE “очиститЃE, для заЃEЃEъьыGя ЃEэффициеыQЃEъьжмитЃE“Ок”, для завершеня ввьCЃEЃE“завершитьЃE

ПьGск ЃEрней упрощеЃEдо ЃEеделЃE Вам достатъHыM указатЃEыDЃEходиЃEю точнъBть ЃEвыбратЃEЃEтоЃEЃEисЃE: бисеЃEиоыZЃEилЃE ЃEЃEинирьAаныZЃE

6.5. ИсхьCыZЃEтеЃEЃEЃEьBраЃEЃE/b>

UNIT1

Dim curcell As Range

Dim ma As Double

Dim Ao As Double

Public Function F(x As Variant)

F = (x ^ 20 * Range("a20").Value) + (x ^ 19 * Range("a19").Value) + (x ^ 18 * Range("a18").Value) + (x ^ 17 * Range("a17").Value) + (x ^ 16 * Range("a16").Value) + (x ^ 15 * Range("a15").Value) + (x ^ 14 * Range("a14").Value) + (x ^ 13 * Range("a13").Value) + (x ^ 12 * Range("a12").Value) + (x ^ 11 * Range("a11").Value) + (x ^ 10 * Range("a10").Value) + (x ^ 9 * Range("a9").Value) + (x ^ 8 * Range("a8").Value) + (x ^ 7 * Range("a7").Value) + (x ^ 6 * Range("a6").Value) + (x ^ 5 * Range("a5").Value) + (x ^ 4 * Range("a4").Value) + (x ^ 3 * Range("a3").Value) + (x ^ 2 * Range("a2").Value) + (x * Range("a1").Value) + Range("a21").Value

End Function

Public Function F1(x As Variant)

F1 = (x ^ 20 * Range("j20").Value) + (x ^ 19 * Range("j19").Value) + (x ^ 18 * Range("j18").Value) + (x ^ 17 * Range("j17").Value) + (x ^ 16 * Range("j16").Value) + (x ^ 15 * Range("j15").Value) + (x ^ 14 * Range("j14").Value) + (x ^ 13 * Range("j13").Value) + (x ^ 12 * Range("j12").Value) + (x ^ 11 * Range("j11").Value) + (x ^ 10 * Range("j10").Value) + (x ^ 9 * Range("j9").Value) + (x ^ 8 * Range("j8").Value) + (x ^ 7 * Range("j7").Value) + (x ^ 6 * Range("j6").Value) + (x ^ 5 * Range("j5").Value) + (x ^ 4 * Range("j4").Value) + (x ^ 3 * Range("j3").Value) + (x ^ 2 * Range("j2").Value) + (x * Range("j1").Value) + Range("j21").Value

End Function

Public Function F2(x As Variant)

F2 = (x ^ 20 * Range("m20").Value) + (x ^ 19 * Range("m19").Value) + (x ^ 18 * Range("m18").Value) + (x ^ 17 * Range("m17").Value) + (x ^ 16 * Range("m16").Value) + (x ^ 15 * Range("m15").Value) + (x ^ 14 * Range("m14").Value) + (x ^ 13 * Range("m13").Value) + (x ^ 12 * Range("m12").Value) + (x ^ 11 * Range("m11").Value) + (x ^ 10 * Range("m10").Value) + (x ^ 9 * Range("m9").Value) + (x ^ 8 * Range("m8").Value) + (x ^ 7 * Range("m7").Value) + (x ^ 6 * Range("m6").Value) + (x ^ 5 * Range("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("ЛисЃE").Select

Range("e1").Select

For i = -10 To 10

ActiveCell.Value = F(i)

ActiveCell.Cells(2).Select

Next i

End Sub

Public Function DetectBorders()

' ФунЃEЃE ъ@редеЃEыGя границ действителЃEых ЃEрней

ma = 0

For Each curcell In Range("Koeffs")

If curcell.Value > ma Then ma = curcell.Value

If curcell.Value <> 0 Then Ao = curcell.Value

Next curcell

DetectBorders = 1 + (ma * Ao)

End Function

UNIT2

Sub auto_open()

Sheets("ЛисЃE").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 ("ВыхьC за ЃEеделЃEдоЃEстимых значений")

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)

'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").Value)) / 2

End Sub

Private Sub CommandButton3_Click()

Horda_Kas

End Sub

Private Sub UserForm_Deactivate()

ListBox1.Clear

TextBox1.Value = 0

End Sub

Sub Perenos()

Range("a1").Value = Range("L1").Value

Range("a2").Value = Range("L2").Value

Range("a3").Value = Range("L3").Value

Range("a4").Value = Range("L4").Value

Range("a5").Value = Range("L5").Value

Range("a6").Value = Range("L6").Value

Range("a7").Value = Range("L7").Value

Range("a8").Value = Range("L8").Value

Range("a9").Value = Range("L9").Value

Range("a10").Value = Range("L10").Value

Range("a11").Value = Range("L11").Value

Range("a12").Value = Range("L12").Value

Range("a13").Value = Range("L13").Value

Range("a14").Value = Range("L14").Value

Range("a15").Value = Range("L15").Value

Range("a16").Value = Range("L16").Value

Range("a17").Value = Range("L17").Value