From 1454040f9045f5be208fe2c0f52ee4ca5075a86f Mon Sep 17 00:00:00 2001 From: tailuge Date: Sat, 16 Nov 2024 17:31:35 +0000 Subject: [PATCH] plotly --- dist/diagrams/mathaven.html | 62 ++++++++++--------------------------- src/mathaven.ts | 49 ++++++++++++++++++++++++++--- 2 files changed, 61 insertions(+), 50 deletions(-) diff --git a/dist/diagrams/mathaven.html b/dist/diagrams/mathaven.html index 751ae90e..4c59b9e0 100644 --- a/dist/diagrams/mathaven.html +++ b/dist/diagrams/mathaven.html @@ -1,6 +1,6 @@ + - mathaven diagrams @@ -8,48 +8,20 @@ + - loaded +

mathaven diagrams

- + + \ No newline at end of file diff --git a/src/mathaven.ts b/src/mathaven.ts index 9e18a3a0..9e6df1ec 100644 --- a/src/mathaven.ts +++ b/src/mathaven.ts @@ -1,16 +1,55 @@ import { NumericCalculation } from "./model/physics/claude/geminipro" -console.log("Calling"); - declare global { interface Window { - plotlyDiv: (id: string, data:any) => void; + plotlyDiv: (id: string, data: any) => void; } } const R = 0.02625 -const numericCalculation = new NumericCalculation(2.0, Math.PI / 4, 1.5*2/R, 2*2/R) +const numericCalculation = new NumericCalculation(2.0, Math.PI / 4, 1.5 * 2 / R, 2 * 2 / R) +try { + numericCalculation.solve() +} catch (error) { + console.error(error) +} + +const trace1 = { + line: { + color: 'rgba(255, 153, 51, 1.0)', + width: '1.3' + }, + mode: 'lines', + name: 'Trace 0', + type: 'scatter', + x: ['2015-01-01', '2015-01-02', '2015-01-03', '2015-01-04', '2015-01-05', '2015-01-06', '2015-01-07', '2015-01-08', '2015-01-09', '2015-01-10', '2015-01-11', '2015-01-12', '2015-01-13', '2015-01-14', '2015-01-15', '2015-01-16', '2015-01-17', '2015-01-18', '2015-01-19', '2015-01-20', '2015-01-21', '2015-01-22', '2015-01-23', '2015-01-24', '2015-01-25', '2015-01-26', '2015-01-27', '2015-01-28', '2015-01-29', '2015-01-30', '2015-01-31', '2015-02-01', '2015-02-02', '2015-02-03', '2015-02-04', '2015-02-05', '2015-02-06', '2015-02-07', '2015-02-08', '2015-02-09', '2015-02-10', '2015-02-11', '2015-02-12', '2015-02-13', '2015-02-14', '2015-02-15', '2015-02-16', '2015-02-17', '2015-02-18', '2015-02-19', '2015-02-20', '2015-02-21', '2015-02-22', '2015-02-23', '2015-02-24', '2015-02-25', '2015-02-26', '2015-02-27', '2015-02-28', '2015-03-01', '2015-03-02', '2015-03-03', '2015-03-04', '2015-03-05', '2015-03-06', '2015-03-07', '2015-03-08', '2015-03-09', '2015-03-10', '2015-03-11', '2015-03-12', '2015-03-13', '2015-03-14', '2015-03-15', '2015-03-16', '2015-03-17', '2015-03-18', '2015-03-19', '2015-03-20', '2015-03-21', '2015-03-22', '2015-03-23', '2015-03-24', '2015-03-25', '2015-03-26', '2015-03-27', '2015-03-28', '2015-03-29', '2015-03-30', '2015-03-31', '2015-04-01', '2015-04-02', '2015-04-03', '2015-04-04', '2015-04-05', '2015-04-06', '2015-04-07', '2015-04-08', '2015-04-09', '2015-04-10'], + y: [0.5353935439391206, -0.3510205670171982, -1.3420793330744663, -1.683479706754631, -2.0207368899942826, 0.006604084375472663, 0.8037048387382045, 1.6685589999803645, 1.2683547027403048, -1.3330462677331034, -1.8663123665480104, -2.8051461261147357, -4.563508055068453, -3.7591847216910996, -3.5134185618878746, -5.3419268826351995, -3.332156069299614, -3.5678897362109545, -3.8548236009547465, -4.58628192762981, -4.116554826788904, -2.7610003378381496, -2.621859111953831, -2.6349689848833315, -2.0581142585936076, -0.7744078058377932, 0.9002451055355818, 0.8373590393039949, 0.5532093840234236, 1.469976651890828, 3.1860367266233904, 2.493612510772345, 1.9464391258267615, 1.8807283125005585, 3.0189402685173534, 4.556005864163605, 5.516442345945973, 4.319606652282435, 6.845756127344204, 7.053236096270982, 7.681494725458877, 7.526563745782537, 8.858342186205558, 9.021889375014881, 8.209805336778926, 9.383959972549016, 11.195848970970625, 12.561537445362251, 14.373511358982237, 15.887456275652418, 14.491455240251522, 15.199461217404735, 16.378844807972094, 14.348345501207364, 14.961597203409823, 15.457566696478484, 14.942769687687289, 15.721527909780036, 13.091278962257627, 14.295247001092115, 15.296655272416865, 14.436440585461526, 13.912453188370755, 12.433861225213807, 14.061345247447989, 13.326092951912521, 13.566974950387175, 12.96345607653163, 12.205278846692087, 11.364010452431279, 12.120962982512733, 13.570258079014422, 14.613857418348378, 15.48868026864105, 15.421250297066777, 16.562957844203055, 16.365666723485436, 15.848038393086913, 16.170083705874156, 16.446617416519754, 15.024371154281331, 14.802238239296665, 13.156751496135007, 14.06168725142282, 14.94588113322983, 14.127589669913032, 13.885898170515487, 13.692030694564533, 14.943253908206318, 14.529368596515058, 14.661473471114782, 13.67375983483632, 13.382284458918326, 12.527287002966496, 12.767994473001014, 12.651030056419879, 12.141617852418765, 13.606694447410502, 13.923089943159189, 14.003348672865656] +}; +const trace2 = { + line: { + color: 'rgba(55, 128, 191, 1.0)', + width: '1.3' + }, + mode: 'lines', + name: 'Trace 1', + type: 'scatter', + x: ['2015-01-01', '2015-01-02', '2015-01-03', '2015-01-04', '2015-01-05', '2015-01-06', '2015-01-07', '2015-01-08', '2015-01-09', '2015-01-10', '2015-01-11', '2015-01-12', '2015-01-13', '2015-01-14', '2015-01-15', '2015-01-16', '2015-01-17', '2015-01-18', '2015-01-19', '2015-01-20', '2015-01-21', '2015-01-22', '2015-01-23', '2015-01-24', '2015-01-25', '2015-01-26', '2015-01-27', '2015-01-28', '2015-01-29', '2015-01-30', '2015-01-31', '2015-02-01', '2015-02-02', '2015-02-03', '2015-02-04', '2015-02-05', '2015-02-06', '2015-02-07', '2015-02-08', '2015-02-09', '2015-02-10', '2015-02-11', '2015-02-12', '2015-02-13', '2015-02-14', '2015-02-15', '2015-02-16', '2015-02-17', '2015-02-18', '2015-02-19', '2015-02-20', '2015-02-21', '2015-02-22', '2015-02-23', '2015-02-24', '2015-02-25', '2015-02-26', '2015-02-27', '2015-02-28', '2015-03-01', '2015-03-02', '2015-03-03', '2015-03-04', '2015-03-05', '2015-03-06', '2015-03-07', '2015-03-08', '2015-03-09', '2015-03-10', '2015-03-11', '2015-03-12', '2015-03-13', '2015-03-14', '2015-03-15', '2015-03-16', '2015-03-17', '2015-03-18', '2015-03-19', '2015-03-20', '2015-03-21', '2015-03-22', '2015-03-23', '2015-03-24', '2015-03-25', '2015-03-26', '2015-03-27', '2015-03-28', '2015-03-29', '2015-03-30', '2015-03-31', '2015-04-01', '2015-04-02', '2015-04-03', '2015-04-04', '2015-04-05', '2015-04-06', '2015-04-07', '2015-04-08', '2015-04-09', '2015-04-10'], + y: [-2.58404773330316, -1.9162964761259451, -1.8899798841571565, -1.098466181069551, -1.2161136413159992, -0.9298011508867184, -2.5216450120142193, -1.5547013224314532, -3.1293219775443117, -2.7232351981528025, -1.704449229625379, -1.2702366750752472, -1.7688923656442583, -1.9810878959630682, -1.0881359248000217, -0.5214761704035035, -0.639866394654719, -2.258513886233204, -0.8711892253875131, -0.45426547393253053, -2.4076676391235785, -2.2450025826137097, -2.3488062397069234, -3.2188990647525304, -2.6042445674055594, -2.9702468803291966, -4.139691822816822, -3.9967022316870042, -4.796271521377118, -5.244924380701339, -6.965620503609484, -6.430396926773768, -5.234457265252843, -6.181791776690352, -7.3464387119459085, -7.085650875056526, -6.795217278293396, -6.08725142043377, -5.3416313194169875, -4.900094995211111, -4.715363010029477, -3.6757033584677927, -5.873900613367271, -7.685787089886274, -8.833149292574403, -9.373517123532867, -10.519456187180836, -8.012082850355387, -8.556759031756883, -8.78527769843948, -8.801850250864483, -9.031427690493008, -9.289972806031075, -8.434541044235305, -8.543619303217836, -9.817816201809572, -9.691704922707196, -9.172230718814316, -10.389025830978015, -9.418276522564378, -8.844666134378604, -10.649699554950736, -11.433978738990442, -11.022214964648152, -11.156982299530265, -12.846500605483975, -12.700459270895378, -13.701718476553872, -14.281259852458456, -13.197701892598191, -13.444607930505104, -12.703127086621702, -12.38184968649959, -13.545422038889187, -12.062411162554307, -12.190051993521331, -13.801739083658532, -14.198265394729127, -14.29078542197376, -13.45263060195906, -13.130412206893606, -14.189794518505105, -12.647928857811877, -13.252175401809115, -13.526006774399674, -13.640567463371012, -13.234252510186453, -12.313307209824384, -11.218557557877709, -10.7821947135954, -8.89016408336461, -9.662631443485989, -6.909371824212538, -7.048202688582138, -4.971706592042745, -4.310618310025603, -2.954237793688564, -2.0883264569176156, 1.1805740980198571, 0.5040426644599496] +}; +const trace3 = { + line: { + color: 'rgba(50, 171, 96, 1.0)', + width: '1.3' + }, + mode: 'lines', + name: 'Trace 2', + type: 'scatter', + x: ['2015-01-01', '2015-01-02', '2015-01-03', '2015-01-04', '2015-01-05', '2015-01-06', '2015-01-07', '2015-01-08', '2015-01-09', '2015-01-10', '2015-01-11', '2015-01-12', '2015-01-13', '2015-01-14', '2015-01-15', '2015-01-16', '2015-01-17', '2015-01-18', '2015-01-19', '2015-01-20', '2015-01-21', '2015-01-22', '2015-01-23', '2015-01-24', '2015-01-25', '2015-01-26', '2015-01-27', '2015-01-28', '2015-01-29', '2015-01-30', '2015-01-31', '2015-02-01', '2015-02-02', '2015-02-03', '2015-02-04', '2015-02-05', '2015-02-06', '2015-02-07', '2015-02-08', '2015-02-09', '2015-02-10', '2015-02-11', '2015-02-12', '2015-02-13', '2015-02-14', '2015-02-15', '2015-02-16', '2015-02-17', '2015-02-18', '2015-02-19', '2015-02-20', '2015-02-21', '2015-02-22', '2015-02-23', '2015-02-24', '2015-02-25', '2015-02-26', '2015-02-27', '2015-02-28', '2015-03-01', '2015-03-02', '2015-03-03', '2015-03-04', '2015-03-05', '2015-03-06', '2015-03-07', '2015-03-08', '2015-03-09', '2015-03-10', '2015-03-11', '2015-03-12', '2015-03-13', '2015-03-14', '2015-03-15', '2015-03-16', '2015-03-17', '2015-03-18', '2015-03-19', '2015-03-20', '2015-03-21', '2015-03-22', '2015-03-23', '2015-03-24', '2015-03-25', '2015-03-26', '2015-03-27', '2015-03-28', '2015-03-29', '2015-03-30', '2015-03-31', '2015-04-01', '2015-04-02', '2015-04-03', '2015-04-04', '2015-04-05', '2015-04-06', '2015-04-07', '2015-04-08', '2015-04-09', '2015-04-10'], + y: [0.4661114764240781, 1.0610769506804194, 1.0620659379275244, -0.5603096501263787, -0.22966983294858567, 1.1358334022099883, 1.8697838063194905, 1.8307593169232188, 2.6294937170536055, 1.456439760404607, 3.571977139947352, 3.305623978930223, 4.369054542737759, 4.134928856846778, 2.525747905079978, 4.45625041538837, 5.331621195457201, 5.01722152487662, 3.2730061427478807, 2.3895586625726164, 1.5551868349111646, 0.9222137047406664, -0.2408476097748915, -0.7735805458656726, -0.8871954038346644, -1.9822438634492547, -0.8886612143982666, -0.7149527896910689, -1.1377284325144619, -1.7585300048885872, -2.8117170543153254, -2.6809842525932175, -1.6457602974924186, -2.1361202183757593, -3.506112394459107, -3.338531391597358, -5.511057758779813, -3.5261371875358676, -4.05255557741406, -5.188415501615373, -6.032557392677557, -5.6858700345353785, -6.667528307767753, -6.733517550988596, -7.0502984033473615, -7.574898212324232, -7.1843491903366, -6.080355259797091, -6.398354606750326, -6.286331305269291, -7.175762338255774, -6.6277002690607105, -6.031655281290095, -5.243102836583583, -4.612608200873672, -5.180512683218164, -5.0321319726702916, -4.567844497333498, -3.347239903958168, -2.5263058621799597, -3.554423668680612, -1.7466537357472816, 0.08618389027480222, 1.0223852208396356, 2.2260700096326724, 2.976731277433707, 2.5457541264066235, 2.412842465270771, 2.1270496073872933, 4.350264423349324, 3.6000820362032346, 3.6547717673422704, 4.29856786980301, 4.61832134099102, 5.1364308299997825, 5.647209819441451, 6.041357011724418, 4.789997568683162, 6.041650920258338, 5.860878612223213, 5.6050673038102214, 3.900259274681964, 2.1974477295325476, 0.979239291658772, 0.9769412141062032, 1.1215546396840912, 1.4131546401228463, -0.5715019565360024, -0.4798030419178908, -0.19867316746947167, -1.3237063703965808, -1.5132847802948692, -0.9466159703619573, 1.3543877997088902, 1.3745632832250965, 1.2843024279329955, 1.1384756757773304, 1.841477239971831, 1.0626945214201182, 1.6018849370336259] +}; +const data = [trace1, trace2, trace3]; + +window.plotlyDiv("a", data) -window.plotlyDiv("a",numericCalculation)