JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/3.8.0/math.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="https://wzrd.in/standalone/function-plot@1.17.3"></script>
<body>
<form id="form">
  <label for="eq">Steps:</label>
  <input type="text" id="eq" value="10" />
  <label for="alpha">Rate:</label>
  <input type="text" id="alpha" value="0.3" />
  <input type="submit" value="Learn" />
</form>
<div id="plot"></div>
<P><div id="logs"></div></P>
</body>

CSS

input[type=text] {
      width: 30px;
    }
    input {
      padding: 6px;
    }
    body, html, input {
      font-family: sans-serif;
      font-size: 11pt;

    }
    form {
      margin: 20px 0;
    }

JavaScript

/*
Sample Linear Regression in Javascript

Needs External Resources:
http://cdnjs.cloudflare.com/ajax/libs/mathjs/3.8.0/math.min.js
http://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js
https://wzrd.in/standalone/function-plot@1.17.3
( which is from https://github.com/maurizzzio/function-plot )
*/

var graph = new Array(); //start an array to hold graph

function draw(graphs, xrange, yrange) {
    try {
      functionPlot({
        target: '#plot',
        yAxis: {domain: [-xrange, xrange]},
        xAxis: {domain: [-yrange, yrange]},
        data: graphs,
      });
    }
    catch (err) {
      console.log(err);
      alert(err);
    }
  }


/*
Here is some sample data... just two dimensions,
Each row is a test we did by putting in a number (or numbers)
and measuring the output, which we wrote down.

1. the first column is the known output value we measured

2. the second (and following) columns are the inputs that    produced that known value.

So we are trying to come up with a quick way to predict the first column given new values in the second and following columns.
*/
var data = [
[6.1101,17.592],
[5.5277,9.1302],
[8.5186,13.662],
[7.0032,11.854],
[5.8598,6.8233],
[8.3829,11.886],
[7.4764,4.3483],
[8.5781,12],
[6.4862,6.5987],
[5.0546,3.8166],
[5.7107,3.2522],
[14.164,15.505],
[5.734,3.1551],
[8.4084,7.2258],
[5.6407,0.71618],
[5.3794,3.5129],
[6.3654,5.3048],
[5.1301,0.56077],
[6.4296,3.6518],
[7.0708,5.3893],
[6.1891,3.1386],
[20.27,21.767],
[5.4901,4.263],
[6.3261,5.1875],
[5.5649,3.0825],
[18.945,22.638],
[12.828,13.501],
[10.957,7.0467],
[13.176,14.692],
[22.203,24.147],
[5.2524,-1.22],
[6.5894,5.9966],
[9.2482,12.134],
[5.8918,1.8495],
[8.2111,6.5426],
[7.9334,...