Option Strict On
Module Module1
    Const eps As Double = 0.00001
    Function F(ByVal t As Double, ByVal x As Double) As Double
        Return t * x ^ 4 + x ^ 2 + 5 * x - 6
    End Function
    Function Fpr(ByVal t As Double, ByVal x As Double) As Double
        Return 4 * t * x ^ 3 + 2 * x + 5
    End Function
    Function D(ByVal a As Double, ByVal b As Double, ByVal t As Double) As Double
        Dim c As Double
        Do
            c = (a + b) / 2
            If F(t, a) * F(t, c) < 0 Then
                b = c
            Else
                a = c
            End If

        Loop Until (b - a) / 2 < eps
        Return c
    End Function
    Function K(ByVal x0 As Double, ByVal t As Double) As Double
        Dim x As Double
        Do
            x = x0 - F(t, x0) / Fpr(t, x0)
            x0 = x
        Loop Until F(t, x0) / Fpr(t, x0) < eps
        Return x
    End Function
    Sub Main()

        Dim t As Double
        Dim tmax As Double = 1
        Dim tmin As Double = 0
        Dim dt As Double = 0.1
        Dim a As Double = 0.9
        Dim b As Double = 1
        For i As Integer = 0 To CInt((tmax - tmin) / dt)
            t = tmin + i * dt
            Console.WriteLine("{0:F1}  {1:F5}  {2:F5} ", t, D(a, b, t), K(a, t))
        Next i
        Console.ReadLine()
    End Sub

End Module
