ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Software

Point/Slope (y – y)= m(x - x) Linear Equation Auto-Graphing Tool (Free Software)

Updated on June 23, 2012

I’m sure there are apps for this, but if you do not have one this program might be useful; particularly for math students working with linear equations. You will need Microsoft Excel. We will go through how to install the program here. It will involve copying and pasting my code into Excel. Open up Excel, save the new file as “pointslope.xlsm”. In newer versions of Windows, you will save as type “Excel Macro-Enabled Workbook”. This will be a spreadsheet with embedded code to calculate points and graph a line. You will need access to the Developers tab in Excel. To make it visible in the new spreadsheet do as follows:

1. File --> Options (click)

2. Customize Ribbon (click)

3. In “Main Tabs” check the “Developer” box and click “OK” at bottom.

4. You will now see “Developer” tab. Click it.

5. Section dealing with macros and VBA (Visual Basic) is now visible.

We will now create a macro, into which we will later paste some code. Over on the left, find the tab “Record Macro”. A box pops up. It will have been given a default name, just leave it. There will also be a shortcut key entry, make it “ctrl a”. Click OK. Do not press any keys , or you will actually start recording keystrokes in the macro. Rather, immediately click the “stop recording” tab, located in same place where “Record Macro” was. We have created a blank routine into which we will now place some code. Click on “Macros” and you will see the blank macro we just created. Click “Edit”. The macro will open up in a window, see picture in the diagram. Place the blinking cursor as shown. In order to do so, you will have to down arrow key until the cursor sits next to "End Sub". Hit Enter key 5 times to move "End Sub" down. Up arrow key 3 times to put the cursor between "End Sub" and lines above it. Now copy and paste in this code:

Dim x As Single, y As Single, m As Single, xstr As String, ystr As String, mstr As String, eqnstr As String, tempstr As String

Dim x1 As Single, y1 As Single, x2 As Single, y2 As Single, x3 As Single, y3 As Single

Dim num As Single, den As Single, numstr As String, denstr As String

Dim mstrlen As Single, xstrlen As Single, ystrlen As Single

On Error GoTo BadCalculation

MsgBox _

"You will be asked to enter slope and an (x,y) point. Fractional form is acceptable," & vbCrLf & _

"using single digit only in NUMERATOR. For example, slope = -10/50 is not acceptable. Use -1/5 instead." & vbCrLf & _

vbCrLf & _

"1/500 or 1/5000 is OK, denominator can be greater than one digit." & vbCrLf & _

"If errant data is submitted, program will end with error message", vbOKOnly

Sheets("Sheet1").Activate

If ActiveSheet.ChartObjects.Count = 1 Then

ActiveSheet.ChartObjects(1).Delete

Else

End If

mstr = InputBox("Enter slope: i.e. -1/2, 5, 0.3")

mstrlen = Len(mstr)

If InStr(mstr, "/") <> 0 And Mid(mstr, 1, 1) = "-" And Mid(mstr, 3, 1) <> "/" Then GoTo BadCalculation

If InStr(mstr, "/") <> 0 And Mid(mstr, 1, 1) <> "-" And Mid(mstr, 2, 1) <> "/" Then GoTo BadCalculation

If Mid(mstr, 3, 1) = "/" Then

numstr = Mid(mstr, 1, 2)

num = Val(numstr)

denstr = Mid(mstr, 4, (mstrlen - 2))

den = Val(denstr)

m = num / den

Else

End If

If Mid(mstr, 2, 1) = "/" Then

numstr = Mid(mstr, 1, 1)

num = Val(numstr)

denstr = Mid(mstr, 3, (mstrlen - 2))

den = Val(denstr)

m = num / den

Else

End If

If InStr(mstr, "/") = 0 Then

m = Val(mstr)

Else

End If

If m = 0 And mstr <> "0" Then GoTo BadCalculation

xstr = InputBox("Enter x value of point on line: i.e. -1/2, 5, 0.3")

xstrlen = Len(xstr)

If InStr(xstr, "/") <> 0 And Mid(xstr, 1, 1) = "-" And Mid(xstr, 3, 1) <> "/" Then GoTo BadCalculation

If InStr(xstr, "/") <> 0 And Mid(xstr, 1, 1) <> "-" And Mid(xstr, 2, 1) <> "/" Then GoTo BadCalculation

If Mid(xstr, 3, 1) = "/" Then

numstr = Mid(xstr, 1, 2)

num = Val(numstr)

denstr = Mid(xstr, 4, (xstrlen - 2))

den = Val(denstr)

x = num / den

Else

End If

If Mid(xstr, 2, 1) = "/" Then

numstr = Mid(xstr, 1, 1)

num = Val(numstr)

denstr = Mid(xstr, 3, (xstrlen - 2))

den = Val(denstr)

x = num / den

Else

End If

If InStr(xstr, "/") = 0 Then

x = Val(xstr)

Else

End If

If x = 0 And xstr <> "0" Then GoTo BadCalculation

ystr = InputBox("Enter y value of point on line: i.e. -1/2, 5, 0.3")

ystrlen = Len(ystr)

If InStr(ystr, "/") <> 0 And Mid(ystr, 1, 1) = "-" And Mid(ystr, 3, 1) <> "/" Then GoTo BadCalculation

If InStr(ystr, "/") <> 0 And Mid(ystr, 1, 1) <> "-" And Mid(ystr, 2, 1) <> "/" Then GoTo BadCalculation

If Mid(ystr, 3, 1) = "/" Then

numstr = Mid(ystr, 1, 2)

num = Val(numstr)

denstr = Mid(ystr, 4, (ystrlen - 2))

den = Val(denstr)

y = num / den

Else

End If

If Mid(ystr, 2, 1) = "/" Then

numstr = Mid(ystr, 1, 1)

num = Val(numstr)

denstr = Mid(ystr, 3, (ystrlen - 2))

den = Val(denstr)

y = num / den

Else

End If

If InStr(xstr, "/") = 0 Then

y = Val(ystr)

Else

End If

If y = 0 And ystr <> "0" Then GoTo BadCalculation

If x >= 0 And y >= 0 Then

eqnstr = "(y - " & ystr & ")" & " = " & mstr & "(x - " & xstr & ")"

Else

End If

If x >= 0 And y < 0 Then

ystr = Right(ystr, (Len(ystr) - 1))

eqnstr = "(y + " & ystr & ")" & " = " & mstr & "(x - " & xstr & ")"

Else

End If

If x < 0 And y >= 0 Then

xstr = Right(xstr, (Len(xstr) - 1))

eqnstr = "(y - " & ystr & ")" & " = " & mstr & "(x + " & xstr & ")"

Else

End If

If x < 0 And y < 0 Then

ystr = Right(ystr, (Len(ystr) - 1))

xstr = Right(xstr, (Len(xstr) - 1))

eqnstr = "(y + " & ystr & ")" & " = " & mstr & "(x + " & xstr & ")"

Else

End If

Range("$B$1").Select

ActiveCell.Value = eqnstr

If x < 0 Then

x1 = x

y1 = y

Range("$A$2").Select

ActiveCell.Value = x1

Range("$B$2").Select

ActiveCell.Value = y1

x2 = 0

y2 = m * (x2 - x1) + y1

Range("$A$3").Select

ActiveCell.Value = x2

Range("$B$3").Select

ActiveCell.Value = y2

x3 = -2 * x1

y3 = m * (x3 - x1) + y1

Range("$A$4").Select

ActiveCell.Value = x3

Range("$B$4").Select

ActiveCell.Value = y3

Else

End If

If x = 0 Then

x1 = -10

y1 = m * (-10 - x) + y

Range("$A$2").Select

ActiveCell.Value = x1

Range("$B$2").Select

ActiveCell.Value = y1

x2 = 0

y2 = y

Range("$A$3").Select

ActiveCell.Value = x2

Range("$B$3").Select

ActiveCell.Value = y2

x3 = -x1

y3 = m * (x3 - x1) + y1

Range("$A$4").Select

ActiveCell.Value = x3

Range("$B$4").Select

ActiveCell.Value = y3

Else

End If

If x > 0 Then

x1 = -2 * x

y1 = m * (x1 - x) + y

Range("$A$2").Select

ActiveCell.Value = x1

Range("$B$2").Select

ActiveCell.Value = y1

x2 = 0

y2 = m * (x2 - x1) + y1

Range("$A$3").Select

ActiveCell.Value = x2

Range("$B$3").Select

ActiveCell.Value = y2

x3 = x

y3 = y

Range("$A$4").Select

ActiveCell.Value = x3

Range("$B$4").Select

ActiveCell.Value = y3

Else

End If

Range("$B$10").Select

ActiveSheet.Shapes.AddChart.Select

ActiveChart.ChartType = xlXYScatterSmoothNoMarkers

ActiveChart.SetSourceData Source:=Range("Sheet1!$A$2:$B$4")

ActiveChart.SeriesCollection(1).Name = "=Sheet1!$B$1"

ActiveSheet.ChartObjects(1).Name = "Chart 1"

Exit Sub

BadCalculation:

MsgBox "There was a problem with the calculation. Run program again"




When you paste the code in, it is likely there will be areas in red indicating errors in the transfer. They can be corrected (see pictures) by placing the mouse cursor exactly flush with the “dash” at line end and hitting “delete key”. The red type will become black, indicating it is now correct.

Close the program box and re-save the workbook. Hit “ctrl a” and the program will run. That’s it, hope it works well for you. One final note: Excel workbooks come in default mode with three sheets: "Sheet1", "Sheet2", "Sheet3". Might be a good idea to delete "Sheet2" and "Sheet3". Leave "Sheet1" as is, because our program needs it there.

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: "https://hubpages.com/privacy-policy#gdpr"

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)