Public Class Form1
    Dim Graph1 As Graphics
    Dim Pen1 As New Pen(Color.Black, 2)
    Dim drawBrush As New SolidBrush(Color.Black)
    Dim drawFont As New Font("Arial", 10)
    Dim X, Y As Single
    'Графическое решение уравнения
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Graph1 = Me.PictureBox1.CreateGraphics()
        Graph1.Clear(Color.White)
        'Печать шкал математической системы координат
        'в компьютерной системе координат
        For X = -150 To 150 Step 50
            Graph1.DrawString(X / 100, drawFont, drawBrush, X + 150, 50)
        Next X
        For Y = 0 To 200 Step 50
            Graph1.DrawString((Y - 150) / 100, drawFont, drawBrush, 150, 200 - Y)
        Next Y
        'Преобразование компьютерной системыц координат в математическую систему координат
        Graph1.ScaleTransform(1, -1) 'Поворот оси Y 
        Graph1.TranslateTransform(150, -50)
        'Сдвиг по осям X и Y
        'Рисование осей математической системы
        'координат
        Graph1.DrawLine(Pen1, -150, 0, 300, 0) 'Ось X 
        Graph1.DrawLine(Pen1, 0, -150, 0, 50) 'Ось Y
        For X = -150 To 150 Step 50 'Засечки на оси X
            Graph1.DrawLine(Pen1, X, -5, X, 5)
        Next X
        For Y = -100 To 100 Step 50 'Засечки на оси Y
            Graph1.DrawLine(Pen1, -5, Y, 5, Y)
        Next Y
        'График функции 
        For X = -1.5 To 1.5 Step 0.01
            Y = X ^ 3 - Math.Cos(X)
            Graph1.DrawEllipse(Pen1, X * 100, Y * 100, 1, 1)
        Next X
    End Sub
    'Численное решение уравнения
    Dim A, B, C, P As Single
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        A = Val(TextBox1.Text)
        B = Val(TextBox2.Text)
        P = Val(TextBox3.Text)
        Do
            C = (A + B) / 2
            If (A ^ 3 - Math.Cos(A)) * (C ^ 3 - Math.Cos(C)) < 0 Then
                B = C
            Else
                A = C
            End If
        Loop While (B - A) / 2 > P
        Label6.Text = (A + B) / 2

    End Sub

    Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click

    End Sub

    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

    End Sub
End Class
