Equation Finder Code

# Equation Finder Code - ""& y2&""...

This preview shows page 1. Sign up to view the full content.

Jordan Cooper’s Equation Finder Program Code Option Explicit Sub Equation_Finder() ' ' Equation_Finder Macro ' Dim x1 As Single, x2 As Single, y1 As Single, y2 As Single, M As Single, B As Single Dim Formula As String Formula = InputBox("Enter the type of graph paper that the points are plotted on." & vbCrLf & "R for x1 = InputBox("Enter X1") y1 = InputBox("Enter Y1") x2 = InputBox("Enter X2") y2 = InputBox("Enter Y2") If (Formula = "R") Then M = (y2 - y1) / (x2 - x1) B = y2 - (M * x2) MsgBox ("The equation of the LINEAR FUNCTION is Y = " & FormatNumber(M ,1) & "X + " & FormatNumber(B, 1) & vbCrLf & "The points used were (" & x1 & " , " & y1 & ")" & " and (" & x2 &
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: " , " & y2 & ")") ElseIf (Formula = "S") Then M = (Log(y2 / y1)) / (x2 - x1) B = (y1 / (Exp(M * x1))) MsgBox ("The equation of the EXPONENTIAL FUNCTION is Y = " & FormatNumber(B, 3) & " e^ " & FormatNumber(M, 2) & "X") & vbCrLf & "The points used were (" & x1 & " , " & y1 & ")" & " and (" & x2 & " , " & y2 & ")" ElseIf (Formula = "L") Then M = (Log(y2 / y1)) / (Log(x2 / x1)) B = (y1 / (x1 ^ M)) MsgBox ("The equation of the POWER FUNCTION is Y = " & FormatNumber(B, 3) & " X ^ " & FormatNumber(M, 2) & vbCrLf & "The points used were (" & x1 & " , " & y1 & ")" & " and (" & x2 & " , " & y2 & ")") End If End Sub...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online