CodeItBetter Programming Another VB Programming Blog

How to calculate various properties of a quadratic equation by calculus and algebraic methods

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
'Math - How to calculate various properties of a quadratic equation by calculus and algebraic methods
Option Explicit
 
Private Sub Command1_Click()
    On Error GoTo ErrHandler
    Dim A As Double, B As Double, C As Double
    Dim I As Integer
    A = Val(InputBox("Enter the coefficient of x^2"))
    B = Val(InputBox("Enter the coefficient of x"))
    C = Val(InputBox("Enter the constant 'c'"))
    xValues A, B, C
    xValuet A, B, C
    Discriminant A, B, C
ErrHandler:
    Exit Sub
End Sub
 
Private Sub Command2_Click()
    On Error GoTo ErrHandler
    Dim E As Double, F As Double, G As Double, g2 As Double
    Dim I As Integer
    E = Val(InputBox("Enter the coefficient of x^2"))
    F = Val(InputBox("Enter the coefficient of x"))
    G = Val(InputBox("Enter the point where the tangent touches the curve (x-value)"))
    g2 = Val(InputBox("Enter the pointwhere tangent touches the curve (y-value)"))
    GradOfTan E, F, G
    GradOfNorm E, F, G
    RadOfCrve E, F, G, g2
ErrHandler:
    Exit Sub
End Sub
 
Sub xValues(ByVal A As Double, ByVal B As Double, ByVal C As Double)
    Dim s As Double, t As Double, z As Double, v As Double, w As Double, y As Double, xValues As Double
    s = (B ^ 2)
    t = (4 * A * C)
    z = (2 * A)
    v = (s - t)
    w = (-B)
    y = Sqr(v)
    xValues = (w + Sqr(v)) / z
    MsgBox "You entered: The coefficient of x^2 = " & A & ", the coefficient of x = " & B & ",  the constant value 'c' = " & C & ""
    MsgBox "THEREFORE, one x-value = " & xValues & ""
End Sub
 
Function xValuet(ByVal A As Double, ByVal B As Double, ByVal C As Double)
    Dim s As Double, t As Double, z As Double, v As Double, w As Double, y As Double
    s = (B ^ 2)
    t = (4 * A * C)
    z = (2 * A)
    v = (s - t)
    w = (-B)
    y = Sqr(v)
    xValuet = (w - Sqr(v)) / z
 
    MsgBox "The OTHER x-value = " & xValuet & ""
 
 
End Function
 
Function Discriminant(ByVal A As Double, ByVal B As Double, ByVal C As Double)
    Dim s As Double, t As Double
    s = (B ^ 2)
    t = (4 * A * C)
    Discriminant = s - t
 
    MsgBox "The DISCRIMINANT of the equation = " & Discriminant & ""
 
 
End Function
 
Sub GradOfTan(ByVal E As Double, ByVal F As Double, ByVal G As Double)
    Dim h As Double, GradOfTan As Double
    h = (2 * E)
    GradOfTan = (h * G) + F
 
    MsgBox "The tangent touches curve at point = " & G & ""
    MsgBox "THEREFORE, the GRADIENT of the TANGENT at this point = " & GradOfTan & ""
 
End Sub
 
Function GradOfNorm(ByVal E As Double, ByVal F As Double, ByVal G As Double)
    Dim h As Double, h2 As Double
    h = (2 * E)
    h2 = (h * G) + F
    GradOfNorm = (-1) / h2
    MsgBox "The GRADIENT of the NORMAL at this point = " & GradOfNorm & ""
End Function
 
Function RadOfCrve(ByVal E As Double, ByVal F As Double, ByVal G As Double, ByVal g2 As Double)
    Dim h As Double
    h = (2 * E)
    h2 = (h * G) + F
    h3 = 1 + ((h2) ^ 2)
    h4 = (h3) ^ 1.5
    RadOfCrve = h4 / 2
    MsgBox "The RADIUS OF CURVATURE at the point (" & G & ", " & g2 & ") is " & RadOfCrve & ""
End Function
Filed under: Math Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.