Option Strict On
Imports System.IO
Module Module1
    Function f(ByVal n As Integer, ByVal x As Double) As Double
        If n = 0 Then
            Return 0
        ElseIf n = 1 Then
            Return 2 * x
        Else
            Return 2 * x * f(n - 1, x) - (n - 1) * f(n - 2, x)
        End If
    End Function
    Sub Main()
        Dim out As StreamWriter = New StreamWriter("output.csv")
        Dim xmin, xmax, dx, x As Double
        xmin = -1
        xmax = 1
        dx = 0.1
        Dim n As Integer = 5
        For i As Integer = 0 To CInt((xmax - xmin) / dx)
            x = xmin + i * dx
            Console.WriteLine("{0,4:f1} {1,8:f4}", x, f(n, x))
            out.WriteLine("{0}; {1:f4}", x, f(n, x))
        Next i
        out.Close()
        Console.ReadLine()
    End Sub
End Module
