Last active
September 3, 2020 13:46
-
-
Save sverhoeven/bb1265a9a0b0ec7bd0bdc92d4bdc5c76 to your computer and use it in GitHub Desktop.
newtonraphson-iterations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "https://vega.github.io/schema/vega-lite/v4.json", | |
| "width": 800, | |
| "height": 600, | |
| "layer": [ | |
| { | |
| "data": {"sequence": {"start": -20, "stop": 20, "step": 0.1, "as": "x"}}, | |
| "transform": [ | |
| { | |
| "calculate": "datum.x * datum.x * datum.x - datum.x * datum.x + 2", | |
| "as": "y" | |
| } | |
| ], | |
| "mark": "line", | |
| "encoding": { | |
| "x": {"type": "quantitative", "field": "x"}, | |
| "y": {"field": "y", "type": "quantitative"}, | |
| "color": {"value": "#f00"} | |
| } | |
| }, | |
| { | |
| "data": {"values": [{}]}, | |
| "encoding": {"x": {"datum": -1}}, | |
| "layer": [ | |
| {"mark": {"type": "rule", "strokeDash": [4, 8]}}, | |
| { | |
| "mark": { | |
| "type": "text", | |
| "align": "right", | |
| "baseline": "bottom", | |
| "dx": -4, | |
| "dy": 200, | |
| "x": "width", | |
| "text": "root" | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "data": { | |
| "values": [ | |
| { | |
| "id": 0, | |
| "x": -20, | |
| "y": -8398, | |
| "slope": 1240, | |
| "delta_x": -6.77258064516129 | |
| }, | |
| { | |
| "id": 1, | |
| "x": -13.227419354838709, | |
| "y": -2487.295060676882, | |
| "slope": 551.3487070759625, | |
| "delta_x": -4.511292089298747 | |
| }, | |
| { | |
| "id": 2, | |
| "x": -8.716127265539962, | |
| "y": -736.1426852046757, | |
| "slope": 245.34487805834735, | |
| "delta_x": -3.0004404046682724 | |
| }, | |
| { | |
| "id": 3, | |
| "x": -5.715686860871689, | |
| "y": -217.3952864079185, | |
| "slope": 109.43860259636719, | |
| "delta_x": -1.9864589025292883 | |
| }, | |
| { | |
| "id": 4, | |
| "x": -3.729227958342401, | |
| "y": -63.77004081946913, | |
| "slope": 49.1798794125327, | |
| "delta_x": -1.296669320486751 | |
| }, | |
| { | |
| "id": 5, | |
| "x": -2.43255863785565, | |
| "y": -18.311621770293822, | |
| "slope": 22.617141855529702, | |
| "delta_x": -0.8096346517726237 | |
| }, | |
| { | |
| "id": 6, | |
| "x": -1.622923986083026, | |
| "y": -4.9084729683475095, | |
| "slope": 11.147494765976905, | |
| "delta_x": -0.44032072419792323 | |
| }, | |
| { | |
| "id": 7, | |
| "x": -1.1826032618851028, | |
| "y": -1.0524808286924165, | |
| "slope": 6.560857948834061, | |
| "delta_x": -0.1604181704436162 | |
| }, | |
| { | |
| "id": 8, | |
| "x": -1.0221850914414865, | |
| "y": -0.11290508935669852, | |
| "slope": 5.178957266378694, | |
| "delta_x": -0.021800737783581995 | |
| }, | |
| { | |
| "id": 9, | |
| "x": -1.0003843536579045, | |
| "y": -0.001922359257239492, | |
| "slope": 5.00307527244644, | |
| "delta_x": -0.00038423552566289556 | |
| } | |
| ] | |
| }, | |
| "encoding": { | |
| "x": {"field": "x", "type": "quantitative"}, | |
| "y": {"field": "y", "type": "quantitative"}, | |
| "text": {"field": "id", "type": "nominal"} | |
| }, | |
| "layer": [ | |
| { | |
| "mark": "circle", | |
| "selection": {"grid": {"type": "interval", "bind": "scales"}} | |
| }, | |
| {"mark": {"type": "text", "dy": -10}} | |
| ] | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment