Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
This code, when compiled, allows the user to calcu...
Author:
Ahmed Murtaza Zaman
E-mail:
Click to e-mail author
Submitted:
12/29/2002
Version:
VB5
Compatibility:
VB5, VB6
Category:
Mathematics
Views:
11538
This code, when compiled, allows the user to calculate various properties of a quadratic equation by calculus and algebraic methods.
Declarations:
'none
Code:
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 Sub xValues(a As Double, b As Double, c As Double) Dim s, t, z, v, w, y, 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(a As Double, b As Double, c As Double) Dim s, t, z, v, w, 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(a As Double, b As Double, c As Double) Dim s, t As Double s = (b ^ 2) t = (4 * a * c) Discriminant = s - t MsgBox "The DISCRIMINANT of the equation = " & Discriminant & "" End Function 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 GradOfTan(e As Double, f As Double, g As Double) Dim h, 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(e As Double, f As Double, g As Double) Dim h, 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(e As Double, f As Double, g As Double, 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 Private Sub manuZQUAD_Click() frmAbout.Show 1 End Sub Private Sub mnuHelp3_Click() frmBrowser.Show End Sub Private Sub MDIForm_Load() MDIForm1.Show End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement