From 78e8709e6191e62113939cb3cc1c05e6110f8fdf Mon Sep 17 00:00:00 2001 From: Katarzyna Rachwal Date: Fri, 9 Feb 2024 12:49:10 -0500 Subject: [PATCH 1/5] replacing constants and subscripts to fix mathjax pretty printing --- react-frontend/src/components/Charts.tsx | 16 +++- react-frontend/src/lib/constants.ts | 93 ++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 react-frontend/src/lib/constants.ts diff --git a/react-frontend/src/components/Charts.tsx b/react-frontend/src/components/Charts.tsx index f569bd9..7b6e99e 100644 --- a/react-frontend/src/components/Charts.tsx +++ b/react-frontend/src/components/Charts.tsx @@ -3,6 +3,7 @@ import React, { useEffect, useState } from 'react'; import { MathJax, MathJaxContext } from 'better-react-mathjax'; import {parse} from 'mathjs'; import ScatterPlot from './ScatterPlot'; +import constants from '../lib/constants'; interface ChartProps { results: any; @@ -31,7 +32,12 @@ function Charts({ results = {}, toggleDisplay }: ChartProps) { const computeValue = () => { // we are replacing the exponent operator from python to js syntax // we are also replacing the parentheses with the precision at the end of the expression returned from identify - const input = JSON.parse(results.converges_to).replaceAll('**','^').replace(' = 0','').replace(/\s\([0-9]+\)$/,''); + const input = convertConstants(JSON.parse(results.converges_to) + .replaceAll('**','^') + .replace(' = 0','') + .replace(/\s\([0-9]+\)$/,'') + ); + try { const mathy = parse(input).toTex(); return `$$${mathy}$$`; @@ -41,6 +47,14 @@ function Charts({ results = {}, toggleDisplay }: ChartProps) { } }; + const convertConstants = (input: string) => { + let cleanString = input; + for(const c in constants){ + if(constants[c].replacement) cleanString = cleanString.replaceAll(c, constants[c].replacement!!); + } + return cleanString; + }; + const wolframValue = (input: string) => { // wolfram regurgitates the value provided with an approx symbol - truncating const cleanInput = input.indexOf('≈') >= 0 ? input.substring(0, input.indexOf('≈')) : input; diff --git a/react-frontend/src/lib/constants.ts b/react-frontend/src/lib/constants.ts new file mode 100644 index 0000000..28096da --- /dev/null +++ b/react-frontend/src/lib/constants.ts @@ -0,0 +1,93 @@ +interface Constant { + name?: string, + replacement?: string +} + +const constants: {[abbrev: string]: Constant } = { + "sqrt2":{"replacement": "sqrt(2)"}, + "sqrt3": {"replacement": "sqrt(3)"}, + "phi": {"name":"Golden Ratio"}, + "cbrt2": {"replacement": "cbrt(2)"}, + "cbrt3":{"replacement": "cbrt(3)"}, + "root12of2": {"replacement": "nthRoot(2, 12)"}, + "psi": {"replacement": "ψ", "name": "Super Golden Ratio"}, + "mu": {"replacement": "μ", "name":"Hexagonal Lattice Connective Constant"}, + "Kprime": {"replacement": "Κ","name":"Kepler Bouwkamp Constant"}, + "W":{"name":"Wallis Constant"}, + "ln2": {"replacement": "ln(2)"}, + "G_025":{"replacement": "Γ(0.25)"}, + "gamma":{"name":"Euler Mascheroni Constant"}, + "E":{"name":"Erdos Borwein constant"}, + "Omega": {"replacement": "Ω","name":"Omega Constant"}, + "Zeta3":{"replacement": "ζ(3)", "name":"Apery Constant"}, + "L_lim":{"name": "Laplace Limit", "replacement": "L[lim]"}, + "R_S": {"name":"Ramanujan Soldner Constant", "replacement": "R[S]"}, + "G": {"name":"Gauss Constant (ϖ/π)"}, + "L_1": {"name": "First Lemniscate Constant (ϖ/2)", "replacement": "L[1]"}, + "L_2": {"name": "Secnd Lemniscate Constant (π/(2ϖ))", "replacement": "L[2]"}, + "L": {"name": "Liouville Constant"}, + "C_1": {"name": "First Continued Fraction Constant", "replacement": "C[1]"}, + "R": {"name":"Ramanujan Constant"}, + "A": {"name": "Glaisher Kinkelin Constant"}, + "C":{"name":"Catalan Constant"}, + "D": {"name":"Dottie Number"}, + "M": {"name":"Meissel Mertens Constant"}, + "P": {"name":"Universal Parabolic Constant"}, + "epi": {"name":"Gelfond Constant", "replacement": "e^π"}, + "G_S": {"name":"Gelfond-Schneider Constant or Hilbert Number", "replacement": "2^sqrt(2)"}, + "g": {"name":"Golden Angle"}, + "S": {"name":"Sierpiński Constant"}, + "L_R": {"name":"Landau Ramanujan Constant", "replacement": "L[R]"}, + "G_L": {"name":"Gieseking Constant or Lobachevsky Constant", "replacement": "G[L]"}, + "beta": {"name":"Bernstein Constant", "replacement": "β"}, + "T": {"name":"Tribonacci Constant", "replacement": "η"}, + "B_2": {"name":"Brun Constant", "replacement": "B[2]"}, + "Pi_2": {"name":"Twin Primes Constant", "replacement": "Π[2]"}, + "rho": {"name":"Plastic Number", "replacement": "Ρ"}, + "z_975": {"name":"Z Score for 97.5 Percentile Point", "replacement": "z[97.5]"}, + "tau": {"name":"Prouhet Thue Morse Constant", "replacement": "τ"}, + "lambda_GD": {"name":"Golomb Dickman Constant", "replacement": "λ[GD]"}, + "c": {"name":"Asymptotic Lebesgue Constant", "replacement": "Λ[n]"}, + "C_FT": {"name":"Feller Tornier Constant", "replacement": "C[FT]"}, + "C_10": {"name":"Base 10 Champernowne Constant", "replacement": "C[10]"}, + "sigma_10": {"name":"Salem Constant", "replacement": "σ[10]"}, + "K_0": {"name":"Khinchin Constant", "replacement": "K[0]"}, + "beta_Levy": {"name":"First Lévy Constant", "replacement": "β"}, + "eLevy": {"name":"Second Lévy Constant", "replacement": "e^β"}, + "C_CE": {"name":"Copeland Erdős Constant", "replacement": "C[CE]"}, + "A_Pi": {"name":"Mills Constant", "replacement": "A[π]"}, + "delta_G": {"name":"Gompertz Constant", "replacement": "δ[G]"}, + "V_dp": {"name":"Van der Pauw Constant", "replacement": "π/ln(2)"}, + "theta_m": {"name":"Magic Angle", "replacement": "θ[m]"}, + "C_Artin": {"name":"Artin Constant", "replacement": "C[Artin]"}, + "C_P": {"name":"Porter Constant", "replacement": "C[P]"}, + "L_Lochs": {"name":"Loch Constant", "replacement": "L[Lochs]"}, + "D_V": {"name":"Devicci Tesseract Constant", "replacement": "D[V]"}, + "C_N": {"name":"Niven Constant", "replacement": "C[N]"}, + "S_Pi": {"name":"Stephens Constant", "replacement": "S[Pi]"}, + "P_Dragon": {"name":"Paperfolding Constant", "replacement": "P[Dragon]"}, + "psi_Fib": {"name":"Reciprocal Fibonacci Constant", "replacement": "ψ[Fib]"}, + "delta": {"name":"First Feigenbaum Constant", "replacement": "δ"}, + "Delta_3": {"name":"Robbins Constant", "replacement": "∆(3)"}, + "W_S": {"name":"Weierstrass Constant", "replacement": "W[S]"}, + "F": {"name":"Fransén Robinson Constant"}, + "alpha": {"name":"Second Feigenbaum Constant", "replacement": "α"}, + "C_2": {"name":"Second du Bois-Reymond Constant", "replacement":"C[2]"}, + "delta_ETF": {"name":"Erdős-Tenenbaum-Ford Constant", "replacement": "δ[ETF]"}, + "lambda_C": {"name":"Conway Constant", "replacement": "λ[C]"}, + "sigma": {"name":"Hafner-Sarnak-McCurley Constant", "replacement": "σ"}, + "B_H": {"name":"Backhouse Constant", "replacement": "B[H]"}, + "V": {"name":"Viswanath Constant"}, + "q": {"name":"Komornik–Loreti Constant"}, + "C_HBM": {"name":"Heath-Brown–Moroz Constant", "replacement": "C[HBM]"}, + "S_MRB": {"name":"MRB Constant", "replacement": "S[MRB]"}, + "rho_Pi": {"name":"Prime Constant", "replacement": "ρ[Pi]"}, + "sigma_S": {"name":"Somos Quadratic Recurrence Constant", "replacement": "σ[S]"}, + "alpha_F": {"name":"Foias Constant", "replacement": "α[F]"}, + "L_D": {"name":"Logarithmic Capacity of the Unit Disk", "replacement": "L[D]"}, + "T_Pi": {"name":"Taniguchi Constant", "replacement": "T[Pi]"}, + "alpha_GW": {"name":"Goemans Williamson Constant", "replacement": "α[GW]"}, + "alpha_M": {"name":"Madelung Constant", "replacement": "α[M]"} +}; + +export default constants; \ No newline at end of file From 5da970435f60fedcca10a13f2c379b2f0b22f46f Mon Sep 17 00:00:00 2001 From: Katarzyna Rachwal Date: Fri, 9 Feb 2024 14:04:57 -0500 Subject: [PATCH 2/5] Adding comment to explain origin of constants and fixing eslint formatting rules --- react-frontend/.eslintrc.json | 8 +- react-frontend/src/lib/constants.ts | 149 ++++++++++++++-------------- 2 files changed, 82 insertions(+), 75 deletions(-) diff --git a/react-frontend/.eslintrc.json b/react-frontend/.eslintrc.json index ca050d8..c20bbf0 100644 --- a/react-frontend/.eslintrc.json +++ b/react-frontend/.eslintrc.json @@ -1,11 +1,17 @@ { + "settings":{ + "react": { + "version": "detect" + } + }, "env": { "browser": true, "es2021": true }, "extends": ["eslint:recommended", "plugin:react/recommended"], "rules": { - "no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }] + "no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }], + "key-spacing": ["error", { "afterColon": true }] }, "parser": "@typescript-eslint/parser", "parserOptions": { diff --git a/react-frontend/src/lib/constants.ts b/react-frontend/src/lib/constants.ts index 28096da..234c795 100644 --- a/react-frontend/src/lib/constants.ts +++ b/react-frontend/src/lib/constants.ts @@ -3,91 +3,92 @@ interface Constant { replacement?: string } +// See https://github.com/RamanujanMachine/LIReC/blob/main/LIReC/lib/calculator.py for each of the following keys const constants: {[abbrev: string]: Constant } = { - "sqrt2":{"replacement": "sqrt(2)"}, + "sqrt2": {"replacement": "sqrt(2)"}, "sqrt3": {"replacement": "sqrt(3)"}, - "phi": {"name":"Golden Ratio"}, + "phi": {"name": "Golden Ratio"}, "cbrt2": {"replacement": "cbrt(2)"}, - "cbrt3":{"replacement": "cbrt(3)"}, + "cbrt3": {"replacement": "cbrt(3)"}, "root12of2": {"replacement": "nthRoot(2, 12)"}, "psi": {"replacement": "ψ", "name": "Super Golden Ratio"}, - "mu": {"replacement": "μ", "name":"Hexagonal Lattice Connective Constant"}, - "Kprime": {"replacement": "Κ","name":"Kepler Bouwkamp Constant"}, - "W":{"name":"Wallis Constant"}, + "mu": {"replacement": "μ", "name": "Hexagonal Lattice Connective Constant"}, + "Kprime": {"replacement": "Κ","name": "Kepler Bouwkamp Constant"}, + "W": {"name": "Wallis Constant"}, "ln2": {"replacement": "ln(2)"}, - "G_025":{"replacement": "Γ(0.25)"}, - "gamma":{"name":"Euler Mascheroni Constant"}, - "E":{"name":"Erdos Borwein constant"}, - "Omega": {"replacement": "Ω","name":"Omega Constant"}, - "Zeta3":{"replacement": "ζ(3)", "name":"Apery Constant"}, - "L_lim":{"name": "Laplace Limit", "replacement": "L[lim]"}, - "R_S": {"name":"Ramanujan Soldner Constant", "replacement": "R[S]"}, - "G": {"name":"Gauss Constant (ϖ/π)"}, + "G_025": {"replacement": "Γ(0.25)"}, + "gamma": {"name": "Euler Mascheroni Constant"}, + "E": {"name": "Erdos Borwein constant"}, + "Omega": {"replacement": "Ω","name": "Omega Constant"}, + "Zeta3": {"replacement": "ζ(3)", "name": "Apery Constant"}, + "L_lim": {"name": "Laplace Limit", "replacement": "L[lim]"}, + "R_S": {"name": "Ramanujan Soldner Constant", "replacement": "R[S]"}, + "G": {"name": "Gauss Constant (ϖ/π)"}, "L_1": {"name": "First Lemniscate Constant (ϖ/2)", "replacement": "L[1]"}, "L_2": {"name": "Secnd Lemniscate Constant (π/(2ϖ))", "replacement": "L[2]"}, "L": {"name": "Liouville Constant"}, "C_1": {"name": "First Continued Fraction Constant", "replacement": "C[1]"}, - "R": {"name":"Ramanujan Constant"}, + "R": {"name": "Ramanujan Constant"}, "A": {"name": "Glaisher Kinkelin Constant"}, - "C":{"name":"Catalan Constant"}, - "D": {"name":"Dottie Number"}, - "M": {"name":"Meissel Mertens Constant"}, - "P": {"name":"Universal Parabolic Constant"}, - "epi": {"name":"Gelfond Constant", "replacement": "e^π"}, - "G_S": {"name":"Gelfond-Schneider Constant or Hilbert Number", "replacement": "2^sqrt(2)"}, - "g": {"name":"Golden Angle"}, - "S": {"name":"Sierpiński Constant"}, - "L_R": {"name":"Landau Ramanujan Constant", "replacement": "L[R]"}, - "G_L": {"name":"Gieseking Constant or Lobachevsky Constant", "replacement": "G[L]"}, - "beta": {"name":"Bernstein Constant", "replacement": "β"}, - "T": {"name":"Tribonacci Constant", "replacement": "η"}, - "B_2": {"name":"Brun Constant", "replacement": "B[2]"}, - "Pi_2": {"name":"Twin Primes Constant", "replacement": "Π[2]"}, - "rho": {"name":"Plastic Number", "replacement": "Ρ"}, - "z_975": {"name":"Z Score for 97.5 Percentile Point", "replacement": "z[97.5]"}, - "tau": {"name":"Prouhet Thue Morse Constant", "replacement": "τ"}, - "lambda_GD": {"name":"Golomb Dickman Constant", "replacement": "λ[GD]"}, - "c": {"name":"Asymptotic Lebesgue Constant", "replacement": "Λ[n]"}, - "C_FT": {"name":"Feller Tornier Constant", "replacement": "C[FT]"}, - "C_10": {"name":"Base 10 Champernowne Constant", "replacement": "C[10]"}, - "sigma_10": {"name":"Salem Constant", "replacement": "σ[10]"}, - "K_0": {"name":"Khinchin Constant", "replacement": "K[0]"}, - "beta_Levy": {"name":"First Lévy Constant", "replacement": "β"}, - "eLevy": {"name":"Second Lévy Constant", "replacement": "e^β"}, - "C_CE": {"name":"Copeland Erdős Constant", "replacement": "C[CE]"}, - "A_Pi": {"name":"Mills Constant", "replacement": "A[π]"}, - "delta_G": {"name":"Gompertz Constant", "replacement": "δ[G]"}, - "V_dp": {"name":"Van der Pauw Constant", "replacement": "π/ln(2)"}, - "theta_m": {"name":"Magic Angle", "replacement": "θ[m]"}, - "C_Artin": {"name":"Artin Constant", "replacement": "C[Artin]"}, - "C_P": {"name":"Porter Constant", "replacement": "C[P]"}, - "L_Lochs": {"name":"Loch Constant", "replacement": "L[Lochs]"}, - "D_V": {"name":"Devicci Tesseract Constant", "replacement": "D[V]"}, - "C_N": {"name":"Niven Constant", "replacement": "C[N]"}, - "S_Pi": {"name":"Stephens Constant", "replacement": "S[Pi]"}, - "P_Dragon": {"name":"Paperfolding Constant", "replacement": "P[Dragon]"}, - "psi_Fib": {"name":"Reciprocal Fibonacci Constant", "replacement": "ψ[Fib]"}, - "delta": {"name":"First Feigenbaum Constant", "replacement": "δ"}, - "Delta_3": {"name":"Robbins Constant", "replacement": "∆(3)"}, - "W_S": {"name":"Weierstrass Constant", "replacement": "W[S]"}, - "F": {"name":"Fransén Robinson Constant"}, - "alpha": {"name":"Second Feigenbaum Constant", "replacement": "α"}, - "C_2": {"name":"Second du Bois-Reymond Constant", "replacement":"C[2]"}, - "delta_ETF": {"name":"Erdős-Tenenbaum-Ford Constant", "replacement": "δ[ETF]"}, - "lambda_C": {"name":"Conway Constant", "replacement": "λ[C]"}, - "sigma": {"name":"Hafner-Sarnak-McCurley Constant", "replacement": "σ"}, - "B_H": {"name":"Backhouse Constant", "replacement": "B[H]"}, - "V": {"name":"Viswanath Constant"}, - "q": {"name":"Komornik–Loreti Constant"}, - "C_HBM": {"name":"Heath-Brown–Moroz Constant", "replacement": "C[HBM]"}, - "S_MRB": {"name":"MRB Constant", "replacement": "S[MRB]"}, - "rho_Pi": {"name":"Prime Constant", "replacement": "ρ[Pi]"}, - "sigma_S": {"name":"Somos Quadratic Recurrence Constant", "replacement": "σ[S]"}, - "alpha_F": {"name":"Foias Constant", "replacement": "α[F]"}, - "L_D": {"name":"Logarithmic Capacity of the Unit Disk", "replacement": "L[D]"}, - "T_Pi": {"name":"Taniguchi Constant", "replacement": "T[Pi]"}, - "alpha_GW": {"name":"Goemans Williamson Constant", "replacement": "α[GW]"}, - "alpha_M": {"name":"Madelung Constant", "replacement": "α[M]"} + "C": {"name": "Catalan Constant"}, + "D": {"name": "Dottie Number"}, + "M": {"name": "Meissel Mertens Constant"}, + "P": {"name": "Universal Parabolic Constant"}, + "epi": {"name": "Gelfond Constant", "replacement": "e^π"}, + "G_S": {"name": "Gelfond-Schneider Constant or Hilbert Number", "replacement": "2^sqrt(2)"}, + "g": {"name": "Golden Angle"}, + "S": {"name": "Sierpiński Constant"}, + "L_R": {"name": "Landau Ramanujan Constant", "replacement": "L[R]"}, + "G_L": {"name": "Gieseking Constant or Lobachevsky Constant", "replacement": "G[L]"}, + "beta": {"name": "Bernstein Constant", "replacement": "β"}, + "T": {"name": "Tribonacci Constant", "replacement": "η"}, + "B_2": {"name": "Brun Constant", "replacement": "B[2]"}, + "Pi_2": {"name": "Twin Primes Constant", "replacement": "Π[2]"}, + "rho": {"name": "Plastic Number", "replacement": "Ρ"}, + "z_975": {"name": "Z Score for 97.5 Percentile Point", "replacement": "z[97.5]"}, + "tau": {"name": "Prouhet Thue Morse Constant", "replacement": "τ"}, + "lambda_GD": {"name": "Golomb Dickman Constant", "replacement": "λ[GD]"}, + "c": {"name": "Asymptotic Lebesgue Constant", "replacement": "Λ[n]"}, + "C_FT": {"name": "Feller Tornier Constant", "replacement": "C[FT]"}, + "C_10": {"name": "Base 10 Champernowne Constant", "replacement": "C[10]"}, + "sigma_10": {"name": "Salem Constant", "replacement": "σ[10]"}, + "K_0": {"name": "Khinchin Constant", "replacement": "K[0]"}, + "beta_Levy": {"name": "First Lévy Constant", "replacement": "β"}, + "eLevy": {"name": "Second Lévy Constant", "replacement": "e^β"}, + "C_CE": {"name": "Copeland Erdős Constant", "replacement": "C[CE]"}, + "A_Pi": {"name": "Mills Constant", "replacement": "A[π]"}, + "delta_G": {"name": "Gompertz Constant", "replacement": "δ[G]"}, + "V_dp": {"name": "Van der Pauw Constant", "replacement": "π/ln(2)"}, + "theta_m": {"name": "Magic Angle", "replacement": "θ[m]"}, + "C_Artin": {"name": "Artin Constant", "replacement": "C[Artin]"}, + "C_P": {"name": "Porter Constant", "replacement": "C[P]"}, + "L_Lochs": {"name": "Loch Constant", "replacement": "L[Lochs]"}, + "D_V": {"name": "Devicci Tesseract Constant", "replacement": "D[V]"}, + "C_N": {"name": "Niven Constant", "replacement": "C[N]"}, + "S_Pi": {"name": "Stephens Constant", "replacement": "S[Pi]"}, + "P_Dragon": {"name": "Paperfolding Constant", "replacement": "P[Dragon]"}, + "psi_Fib": {"name": "Reciprocal Fibonacci Constant", "replacement": "ψ[Fib]"}, + "delta": {"name": "First Feigenbaum Constant", "replacement": "δ"}, + "Delta_3": {"name": "Robbins Constant", "replacement": "∆(3)"}, + "W_S": {"name": "Weierstrass Constant", "replacement": "W[S]"}, + "F": {"name": "Fransén Robinson Constant"}, + "alpha": {"name": "Second Feigenbaum Constant", "replacement": "α"}, + "C_2": {"name": "Second du Bois-Reymond Constant", "replacement": "C[2]"}, + "delta_ETF": {"name": "Erdős-Tenenbaum-Ford Constant", "replacement": "δ[ETF]"}, + "lambda_C": {"name": "Conway Constant", "replacement": "λ[C]"}, + "sigma": {"name": "Hafner-Sarnak-McCurley Constant", "replacement": "σ"}, + "B_H": {"name": "Backhouse Constant", "replacement": "B[H]"}, + "V": {"name": "Viswanath Constant"}, + "q": {"name": "Komornik–Loreti Constant"}, + "C_HBM": {"name": "Heath-Brown–Moroz Constant", "replacement": "C[HBM]"}, + "S_MRB": {"name": "MRB Constant", "replacement": "S[MRB]"}, + "rho_Pi": {"name": "Prime Constant", "replacement": "ρ[Pi]"}, + "sigma_S": {"name": "Somos Quadratic Recurrence Constant", "replacement": "σ[S]"}, + "alpha_F": {"name": "Foias Constant", "replacement": "α[F]"}, + "L_D": {"name": "Logarithmic Capacity of the Unit Disk", "replacement": "L[D]"}, + "T_Pi": {"name": "Taniguchi Constant", "replacement": "T[Pi]"}, + "alpha_GW": {"name": "Goemans Williamson Constant", "replacement": "α[GW]"}, + "alpha_M": {"name": "Madelung Constant", "replacement": "α[M]"} }; export default constants; \ No newline at end of file From 8bbcc79463e5c7e43be139c9d4204e32b2a02071 Mon Sep 17 00:00:00 2001 From: Katarzyna Rachwal Date: Fri, 9 Feb 2024 14:30:16 -0500 Subject: [PATCH 3/5] Adding new eslint forked node module exclusively for configured spaces --- react-frontend/.eslintrc.json | 5 +- react-frontend/package-lock.json | 19 ++ react-frontend/package.json | 1 + react-frontend/src/components/Charts.tsx | 184 +++++++-------- react-frontend/src/components/Form.tsx | 218 +++++++++--------- .../src/components/PolynomialInput.tsx | 162 ++++++------- react-frontend/src/components/ScatterPlot.tsx | 70 +++--- react-frontend/src/lib/constants.ts | 58 ++--- 8 files changed, 369 insertions(+), 348 deletions(-) diff --git a/react-frontend/.eslintrc.json b/react-frontend/.eslintrc.json index c20bbf0..c3225df 100644 --- a/react-frontend/.eslintrc.json +++ b/react-frontend/.eslintrc.json @@ -11,12 +11,13 @@ "extends": ["eslint:recommended", "plugin:react/recommended"], "rules": { "no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "ignoreRestSiblings": false }], - "key-spacing": ["error", { "afterColon": true }] + "key-spacing": ["error", { "afterColon": true }], + "@stylistic/js/indent": ["error", 4] }, "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": "latest", "sourceType": "module" }, - "plugins": ["react"] + "plugins": ["react", "@stylistic/js"] } diff --git a/react-frontend/package-lock.json b/react-frontend/package-lock.json index 24583df..3a2a9ba 100644 --- a/react-frontend/package-lock.json +++ b/react-frontend/package-lock.json @@ -26,6 +26,7 @@ "web-vitals": "^2.1.4" }, "devDependencies": { + "@stylistic/eslint-plugin-js": "^1.6.1", "@vitejs/plugin-react": "^4.2.0", "cypress": "^13.6.1", "eslint": "^8.54.0", @@ -3682,6 +3683,24 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@stylistic/eslint-plugin-js": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-1.6.1.tgz", + "integrity": "sha512-gHRxkbA5p8S1fnChE7Yf5NFltRZCzbCuQOcoTe93PSKBC4GqVjZmlWUSLz9pJKHvDAUTjWkfttWHIOaFYPEhRQ==", + "dev": true, + "dependencies": { + "acorn": "^8.11.3", + "escape-string-regexp": "^4.0.0", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "peerDependencies": { + "eslint": ">=8.40.0" + } + }, "node_modules/@testing-library/dom": { "version": "8.20.1", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-8.20.1.tgz", diff --git a/react-frontend/package.json b/react-frontend/package.json index be11b45..b0eb422 100644 --- a/react-frontend/package.json +++ b/react-frontend/package.json @@ -44,6 +44,7 @@ ] }, "devDependencies": { + "@stylistic/eslint-plugin-js": "^1.6.1", "@vitejs/plugin-react": "^4.2.0", "cypress": "^13.6.1", "eslint": "^8.54.0", diff --git a/react-frontend/src/components/Charts.tsx b/react-frontend/src/components/Charts.tsx index 7b6e99e..da7094c 100644 --- a/react-frontend/src/components/Charts.tsx +++ b/react-frontend/src/components/Charts.tsx @@ -17,114 +17,114 @@ type WolframResult = { function Charts({ results = {}, toggleDisplay }: ChartProps) { - const [wolframResults, setWolframResults] = useState([]); - const config = { - tex: { - inlineMath: [["$", "$"]], - displayMath: [["$$", "$$"]] - } - }; + const [wolframResults, setWolframResults] = useState([]); + const config = { + tex: { + inlineMath: [["$", "$"]], + displayMath: [["$$", "$$"]] + } + }; - useEffect(() => { - verify(); - }, [results]); + useEffect(() => { + verify(); + }, [results]); - const computeValue = () => { - // we are replacing the exponent operator from python to js syntax - // we are also replacing the parentheses with the precision at the end of the expression returned from identify - const input = convertConstants(JSON.parse(results.converges_to) - .replaceAll('**','^') - .replace(' = 0','') - .replace(/\s\([0-9]+\)$/,'') - ); + const computeValue = () => { + // we are replacing the exponent operator from python to js syntax + // we are also replacing the parentheses with the precision at the end of the expression returned from identify + const input = convertConstants(JSON.parse(results.converges_to) + .replaceAll('**','^') + .replace(' = 0','') + .replace(/\s\([0-9]+\)$/,'') + ); - try { - const mathy = parse(input).toTex(); - return `$$${mathy}$$`; - } catch(e) { - console.log(`failed to parse ${input}`); - return '(unparseable result)'; - } - }; + try { + const mathy = parse(input).toTex(); + return `$$${mathy}$$`; + } catch(e) { + console.log(`failed to parse ${input}`); + return '(unparseable result)'; + } + }; - const convertConstants = (input: string) => { - let cleanString = input; - for(const c in constants){ - if(constants[c].replacement) cleanString = cleanString.replaceAll(c, constants[c].replacement!!); - } - return cleanString; - }; + const convertConstants = (input: string) => { + let cleanString = input; + for(const c in constants){ + if(constants[c].replacement) cleanString = cleanString.replaceAll(c, constants[c].replacement!!); + } + return cleanString; + }; - const wolframValue = (input: string) => { - // wolfram regurgitates the value provided with an approx symbol - truncating - const cleanInput = input.indexOf('≈') >= 0 ? input.substring(0, input.indexOf('≈')) : input; - try { - const mathy = parse(cleanInput).toTex(); - return `$$${mathy}$$`; - } catch(e) { - console.log(`failed to parse ${cleanInput}`); - return '(unparseable result)'; - } - }; + const wolframValue = (input: string) => { + // wolfram regurgitates the value provided with an approx symbol - truncating + const cleanInput = input.indexOf('≈') >= 0 ? input.substring(0, input.indexOf('≈')) : input; + try { + const mathy = parse(cleanInput).toTex(); + return `$$${mathy}$$`; + } catch(e) { + console.log(`failed to parse ${cleanInput}`); + return '(unparseable result)'; + } + }; - const trimLimit = () => { - const decimalPosition = results.limit.indexOf('.'); - return JSON.parse(results.limit).substring(0, 30 + decimalPosition + 1); - }; + const trimLimit = () => { + const decimalPosition = results.limit.indexOf('.'); + return JSON.parse(results.limit).substring(0, 30 + decimalPosition + 1); + }; - const computePairs = (dataset: string) => { - return JSON.parse(results[dataset]); - }; + const computePairs = (dataset: string) => { + return JSON.parse(results[dataset]); + }; - const verify = () => { - axios.post('/verify', {expression: results.limit}) - .then((response) => { - if (response.status != 200) { - console.warn(response.data.error); - } - setWolframResults(response.data.wolfram_says); - }) - .catch((error) => console.log(error)); - } + const verify = () => { + axios.post('/verify', {expression: results.limit}) + .then((response) => { + if (response.status != 200) { + console.warn(response.data.error); + } + setWolframResults(response.data.wolfram_says); + }) + .catch((error) => console.log(error)); + } - return ( -
- -

This is the value of the Polynomial Continued Fraction:

-

{trimLimit()}

-

It seems to converge to:

{computeValue()}

- { wolframResults && wolframResults.length > 0 ? ( -
-

or

-

{wolframValue(wolframResults[0].plaintext)}

-
- ):''} -
- - + return ( +
+ +

This is the value of the Polynomial Continued Fraction:

+

{trimLimit()}

+

It seems to converge to:

{computeValue()}

+ { wolframResults && wolframResults.length > 0 ? ( +
+

or

+

{wolframValue(wolframResults[0].plaintext)}

+
+ ):''} +
+ + Note: the limit is estimated to high confidence using a PSLQ algorithm, but this is not a proof. - - -

The rate of convergence for this Polynomial Continued Fraction (in digits per step):

- -

+ + +

The rate of convergence for this Polynomial Continued Fraction (in digits per step):

+ +

Delta is a measure of the irrationality of a number (read more about it{' '} - + here - + ). The given Polynomial Continued Fraction produces the following finite-depth estimations for Delta: -

- - -
- ); + +
+ ); } export default Charts; diff --git a/react-frontend/src/components/Form.tsx b/react-frontend/src/components/Form.tsx index 6c29218..f83dc22 100644 --- a/react-frontend/src/components/Form.tsx +++ b/react-frontend/src/components/Form.tsx @@ -14,128 +14,128 @@ type XYPair = [number, number]; type CoordinateList = XYPair[]; function Form() { - const [iterationCount, setIterationCount] = useState(1000); - const [numeratorIsValid, setNumeratorValidity] = useState(false); - const [denominatorIsValid, setDenominatorValidity] = useState(false); - const [polynomialA, setPolynomialA] = useState(''); - const [polynomialB, setPolynomialB] = useState(''); - const [results, setResults] = useState([]); - const [showCharts, setShowCharts] = useState(false); + const [iterationCount, setIterationCount] = useState(1000); + const [numeratorIsValid, setNumeratorValidity] = useState(false); + const [denominatorIsValid, setDenominatorValidity] = useState(false); + const [polynomialA, setPolynomialA] = useState(''); + const [polynomialB, setPolynomialB] = useState(''); + const [results, setResults] = useState([]); + const [showCharts, setShowCharts] = useState(false); - useEffect(() => { - document.getElementsByTagName('input')[0].focus(); - }, []); + useEffect(() => { + document.getElementsByTagName('input')[0].focus(); + }, []); - const onlyOneSymbolUsed = function () { - const matches = (polynomialA + polynomialB).matchAll(/([a-zA-Z])/g); - const distinctCharacters = new Set(); - for (const match of matches) { - distinctCharacters.add(match[0]); - } - return distinctCharacters.size <= 1; - }; + const onlyOneSymbolUsed = function () { + const matches = (polynomialA + polynomialB).matchAll(/([a-zA-Z])/g); + const distinctCharacters = new Set(); + for (const match of matches) { + distinctCharacters.add(match[0]); + } + return distinctCharacters.size <= 1; + }; - const errorClassFn = () => { - return `error-message ${onlyOneSymbolUsed() ? 'hidden' : ''}`; - }; + const errorClassFn = () => { + return `error-message ${onlyOneSymbolUsed() ? 'hidden' : ''}`; + }; - const formClassFn = () => { - return `form ${ - numeratorIsValid && denominatorIsValid && onlyOneSymbolUsed() ? '' : 'invalid' - } ${showCharts ? 'hidden' : ''}`; - }; + const formClassFn = () => { + return `form ${ + numeratorIsValid && denominatorIsValid && onlyOneSymbolUsed() ? '' : 'invalid' + } ${showCharts ? 'hidden' : ''}`; + }; - const validateIterations = function (iterations: number) { - if (iterations > 10000 || iterations <= 0) { - setIterationCount(10000); - } else setIterationCount(iterations); - }; + const validateIterations = function (iterations: number) { + if (iterations > 10000 || iterations <= 0) { + setIterationCount(10000); + } else setIterationCount(iterations); + }; - const submit = (e: any) => { - e.preventDefault(); - const body: PostBody = { - a: polynomialA, - b: polynomialB, - symbol: polynomialA.match(/([a-zA-Z])/)?.[0] ?? polynomialB.match(/([a-zA-Z])/)?.[0] ?? '', - i: iterationCount - }; - axios - .post('/analyze', body) - .then((response) => { - if (response.status == 200) { - setResults(response.data); - setShowCharts(true); - } else { - setShowCharts(false); - console.warn(response.data.error); - } - }) - .catch((error) => console.log(error.toJSON())); - }; + const submit = (e: any) => { + e.preventDefault(); + const body: PostBody = { + a: polynomialA, + b: polynomialB, + symbol: polynomialA.match(/([a-zA-Z])/)?.[0] ?? polynomialB.match(/([a-zA-Z])/)?.[0] ?? '', + i: iterationCount + }; + axios + .post('/analyze', body) + .then((response) => { + if (response.status == 200) { + setResults(response.data); + setShowCharts(true); + } else { + setShowCharts(false); + console.warn(response.data.error); + } + }) + .catch((error) => console.log(error.toJSON())); + }; - return ( -
-
-
-

+ return ( +

+ +
+

Welcome to the Ramanujan Machine Polynomial Continued Fraction Explorer. Please enter the a - - n - {' '} + + n + {' '} and b - - n - {' '} + + n + {' '} polynomials below. They will define a continued fraction of the form: -

- polynomial continued fraction template pretty printed -

+

+ polynomial continued fraction template pretty printed +

Which will then be calculated up to depth n. -

+

- { - setNumeratorValidity(fieldValidity); - }} - updatePolynomial={(polynomial: string) => { - setPolynomialA(polynomial); - }}> - { - setDenominatorValidity(fieldValidity); - }} - updatePolynomial={(polynomial: string) => { - setPolynomialB(polynomial); - }}> -
Please limit your polynomials to one variable
-
-
- -
-
- { - validateIterations(Number(event.target.value)); - }} - /> -
-
- -
- - {showCharts ? ( - { - setShowCharts(!showCharts); - }}> - ) : null} -
- ); + { + setNumeratorValidity(fieldValidity); + }} + updatePolynomial={(polynomial: string) => { + setPolynomialA(polynomial); + }}> + { + setDenominatorValidity(fieldValidity); + }} + updatePolynomial={(polynomial: string) => { + setPolynomialB(polynomial); + }}> +
Please limit your polynomials to one variable
+
+
+ +
+
+ { + validateIterations(Number(event.target.value)); + }} + /> +
+
+ +
+ + {showCharts ? ( + { + setShowCharts(!showCharts); + }}> + ) : null} +
+ ); } export default Form; diff --git a/react-frontend/src/components/PolynomialInput.tsx b/react-frontend/src/components/PolynomialInput.tsx index 98cdf36..1cdf82e 100644 --- a/react-frontend/src/components/PolynomialInput.tsx +++ b/react-frontend/src/components/PolynomialInput.tsx @@ -9,95 +9,95 @@ interface PolynomialInputProps { } function PolynomialInput({ - numerator = false, - updateFormValidity, - updatePolynomial + numerator = false, + updateFormValidity, + updatePolynomial }: PolynomialInputProps) { - const [localPoly, setLocalPoly] = React.useState(''); - const [polyClass, setPolyClass] = React.useState('form-field'); - const [errorMessage, setErrorMessage] = React.useState(''); - const [errorClass, setErrorClass] = React.useState('error-message hidden'); + const [localPoly, setLocalPoly] = React.useState(''); + const [polyClass, setPolyClass] = React.useState('form-field'); + const [errorMessage, setErrorMessage] = React.useState(''); + const [errorClass, setErrorClass] = React.useState('error-message hidden'); - const MAX_INPUT_LENGTH = 100; + const MAX_INPUT_LENGTH = 100; - const valid = function () { - setErrorMessage(''); - setErrorClass('error-message hidden'); - setPolyClass('form-field'); - updateFormValidity(true); - }; + const valid = function () { + setErrorMessage(''); + setErrorClass('error-message hidden'); + setPolyClass('form-field'); + updateFormValidity(true); + }; - const invalid = function (errorMessage = '') { - setErrorMessage(errorMessage); - setErrorClass('error-message fade-in'); - setPolyClass('form-field invalid'); - updateFormValidity(false); - }; + const invalid = function (errorMessage = '') { + setErrorMessage(errorMessage); + setErrorClass('error-message fade-in'); + setPolyClass('form-field invalid'); + updateFormValidity(false); + }; - const sanitize = function (input: string) { - // replace all characters that are not valid math expression characters - return input.replaceAll(/[^^()a-zA-Z0-9* ./+-]+/g, ''); - }; + const sanitize = function (input: string) { + // replace all characters that are not valid math expression characters + return input.replaceAll(/[^^()a-zA-Z0-9* ./+-]+/g, ''); + }; - const onlyOneSymbol = function (input: string) { - const matches = input.matchAll(/([a-zA-Z])/g); - const distinctCharacters = new Set(); - for (const match of matches) { - distinctCharacters.add(match[0]); - } - return distinctCharacters.size <= 1; - }; + const onlyOneSymbol = function (input: string) { + const matches = input.matchAll(/([a-zA-Z])/g); + const distinctCharacters = new Set(); + for (const match of matches) { + distinctCharacters.add(match[0]); + } + return distinctCharacters.size <= 1; + }; - const validatePolynomial = function (p: string) { - if (p.length == 0) { - // validate non-empty - invalid('A value is required'); - setLocalPoly(p); - } else if (p.length > MAX_INPUT_LENGTH) { - // validate length - setLocalPoly(p.substring(0, MAX_INPUT_LENGTH)); - } else if (!onlyOneSymbol(p)) { - // validate that there is only one variable in use - invalid('Please limit to one variable'); - setLocalPoly(p); - } else { - // strip extraneous special characters - let clean = sanitize(p); - if (clean !== p) { - setLocalPoly(clean); - } else { - setLocalPoly(p); - try { - parse(p); - valid(); - } catch (e) { - invalid(e!.toString()); - } - } - } - }; + const validatePolynomial = function (p: string) { + if (p.length == 0) { + // validate non-empty + invalid('A value is required'); + setLocalPoly(p); + } else if (p.length > MAX_INPUT_LENGTH) { + // validate length + setLocalPoly(p.substring(0, MAX_INPUT_LENGTH)); + } else if (!onlyOneSymbol(p)) { + // validate that there is only one variable in use + invalid('Please limit to one variable'); + setLocalPoly(p); + } else { + // strip extraneous special characters + let clean = sanitize(p); + if (clean !== p) { + setLocalPoly(clean); + } else { + setLocalPoly(p); + try { + parse(p); + valid(); + } catch (e) { + invalid(e!.toString()); + } + } + } + }; - return ( -
-
- - { - validatePolynomial(event.target.value); - }} - onBlur={() => { - updatePolynomial(localPoly); - }} - placeholder="enter a polynomial" - /> -
-
{errorMessage}
-
- ); + return ( +
+
+ + { + validatePolynomial(event.target.value); + }} + onBlur={() => { + updatePolynomial(localPoly); + }} + placeholder="enter a polynomial" + /> +
+
{errorMessage}
+
+ ); } export default PolynomialInput; diff --git a/react-frontend/src/components/ScatterPlot.tsx b/react-frontend/src/components/ScatterPlot.tsx index 350ef51..1ff81a5 100644 --- a/react-frontend/src/components/ScatterPlot.tsx +++ b/react-frontend/src/components/ScatterPlot.tsx @@ -19,29 +19,29 @@ const ScatterPlot = ({ id, data }:{id:string, data: CoordinatePair[]}) => { svg.selectAll('*').remove(); var v_margin = 20, h_margin = 20, - width = 580 - h_margin, - height = 400 - v_margin; + width = 580 - h_margin, + height = 400 - v_margin; svg.style("overflow", "visible") - .style("background", "#ffffff"); + .style("background", "#ffffff"); svg.append("g").attr("width", width + 5*h_margin) svg.append("g").attr("height", height + 5*v_margin) - .attr("transform", `translate(${h_margin}, ${v_margin})`); + .attr("transform", `translate(${h_margin}, ${v_margin})`); const [minX, maxX] = d3.extent(filteredData, (d) => {return d.x;}); console.debug(`x min ${minX} x max ${maxX}`); const xScale = d3 - .scaleLinear() - .domain([minX!, maxX!]) - .range([0, width - h_margin]); + .scaleLinear() + .domain([minX!, maxX!]) + .range([0, width - h_margin]); const [minY, maxY] = d3.extent(filteredData, (d) => parseFloat(d.y)); console.debug(`y min ${minY} y max ${maxY}`); const yScale = d3 - .scaleLinear() - .domain([minY!, maxY!]) - .range([height -v_margin, 0]); + .scaleLinear() + .domain([minY!, maxY!]) + .range([height -v_margin, 0]); // x axis const xAxis = svg.append("g") @@ -54,38 +54,38 @@ const ScatterPlot = ({ id, data }:{id:string, data: CoordinatePair[]}) => { yAxis.attr("transform",`translate(${h_margin},${v_margin})`); const line = d3 - .line() - .x((d) => xScale(d.x)) - .y((d) => yScale(parseFloat(d.y))).curve(d3.curveBasis); + .line() + .x((d) => xScale(d.x)) + .y((d) => yScale(parseFloat(d.y))).curve(d3.curveBasis); svg.append('g') - .selectAll("dot") - .data(filteredData) - .enter() - .append("circle") - .attr("cx", function (d) { return xScale(d.x); } ) - .attr("cy", function (d) { return yScale(parseFloat(d.y)); } ) - .attr("r", 1.5) - .attr("transform", `translate(${h_margin}, ${v_margin})`) - .style("fill", "var(--accent)"); + .selectAll("dot") + .data(filteredData) + .enter() + .append("circle") + .attr("cx", function (d) { return xScale(d.x); } ) + .attr("cy", function (d) { return yScale(parseFloat(d.y)); } ) + .attr("r", 1.5) + .attr("transform", `translate(${h_margin}, ${v_margin})`) + .style("fill", "var(--accent)"); - svg - .data([filteredData]) - .append('path') - .attr('d', line) - .attr("transform", `translate(${h_margin}, ${v_margin})`) - .attr("fill", "none") - .attr("stroke-dasharray", "2 2") - .attr("stroke-opacity", "0.6") - .attr("stroke-width", "2") - .attr("stroke", "var(--muted)"); + svg + .data([filteredData]) + .append('path') + .attr('d', line) + .attr("transform", `translate(${h_margin}, ${v_margin})`) + .attr("fill", "none") + .attr("stroke-dasharray", "2 2") + .attr("stroke-opacity", "0.6") + .attr("stroke-width", "2") + .attr("stroke", "var(--muted)"); } }, [data]); -return - -; + return + + ; }; export default ScatterPlot; \ No newline at end of file diff --git a/react-frontend/src/lib/constants.ts b/react-frontend/src/lib/constants.ts index 234c795..0046967 100644 --- a/react-frontend/src/lib/constants.ts +++ b/react-frontend/src/lib/constants.ts @@ -5,35 +5,35 @@ interface Constant { // See https://github.com/RamanujanMachine/LIReC/blob/main/LIReC/lib/calculator.py for each of the following keys const constants: {[abbrev: string]: Constant } = { - "sqrt2": {"replacement": "sqrt(2)"}, - "sqrt3": {"replacement": "sqrt(3)"}, - "phi": {"name": "Golden Ratio"}, - "cbrt2": {"replacement": "cbrt(2)"}, - "cbrt3": {"replacement": "cbrt(3)"}, - "root12of2": {"replacement": "nthRoot(2, 12)"}, - "psi": {"replacement": "ψ", "name": "Super Golden Ratio"}, - "mu": {"replacement": "μ", "name": "Hexagonal Lattice Connective Constant"}, - "Kprime": {"replacement": "Κ","name": "Kepler Bouwkamp Constant"}, - "W": {"name": "Wallis Constant"}, - "ln2": {"replacement": "ln(2)"}, - "G_025": {"replacement": "Γ(0.25)"}, - "gamma": {"name": "Euler Mascheroni Constant"}, - "E": {"name": "Erdos Borwein constant"}, - "Omega": {"replacement": "Ω","name": "Omega Constant"}, - "Zeta3": {"replacement": "ζ(3)", "name": "Apery Constant"}, - "L_lim": {"name": "Laplace Limit", "replacement": "L[lim]"}, - "R_S": {"name": "Ramanujan Soldner Constant", "replacement": "R[S]"}, - "G": {"name": "Gauss Constant (ϖ/π)"}, - "L_1": {"name": "First Lemniscate Constant (ϖ/2)", "replacement": "L[1]"}, - "L_2": {"name": "Secnd Lemniscate Constant (π/(2ϖ))", "replacement": "L[2]"}, - "L": {"name": "Liouville Constant"}, - "C_1": {"name": "First Continued Fraction Constant", "replacement": "C[1]"}, - "R": {"name": "Ramanujan Constant"}, - "A": {"name": "Glaisher Kinkelin Constant"}, - "C": {"name": "Catalan Constant"}, - "D": {"name": "Dottie Number"}, - "M": {"name": "Meissel Mertens Constant"}, - "P": {"name": "Universal Parabolic Constant"}, + "sqrt2": {"replacement": "sqrt(2)"}, + "sqrt3": {"replacement": "sqrt(3)"}, + "phi": {"name": "Golden Ratio"}, + "cbrt2": {"replacement": "cbrt(2)"}, + "cbrt3": {"replacement": "cbrt(3)"}, + "root12of2": {"replacement": "nthRoot(2, 12)"}, + "psi": {"replacement": "ψ", "name": "Super Golden Ratio"}, + "mu": {"replacement": "μ", "name": "Hexagonal Lattice Connective Constant"}, + "Kprime": {"replacement": "Κ","name": "Kepler Bouwkamp Constant"}, + "W": {"name": "Wallis Constant"}, + "ln2": {"replacement": "ln(2)"}, + "G_025": {"replacement": "Γ(0.25)"}, + "gamma": {"name": "Euler Mascheroni Constant"}, + "E": {"name": "Erdos Borwein constant"}, + "Omega": {"replacement": "Ω","name": "Omega Constant"}, + "Zeta3": {"replacement": "ζ(3)", "name": "Apery Constant"}, + "L_lim": {"name": "Laplace Limit", "replacement": "L[lim]"}, + "R_S": {"name": "Ramanujan Soldner Constant", "replacement": "R[S]"}, + "G": {"name": "Gauss Constant (ϖ/π)"}, + "L_1": {"name": "First Lemniscate Constant (ϖ/2)", "replacement": "L[1]"}, + "L_2": {"name": "Secnd Lemniscate Constant (π/(2ϖ))", "replacement": "L[2]"}, + "L": {"name": "Liouville Constant"}, + "C_1": {"name": "First Continued Fraction Constant", "replacement": "C[1]"}, + "R": {"name": "Ramanujan Constant"}, + "A": {"name": "Glaisher Kinkelin Constant"}, + "C": {"name": "Catalan Constant"}, + "D": {"name": "Dottie Number"}, + "M": {"name": "Meissel Mertens Constant"}, + "P": {"name": "Universal Parabolic Constant"}, "epi": {"name": "Gelfond Constant", "replacement": "e^π"}, "G_S": {"name": "Gelfond-Schneider Constant or Hilbert Number", "replacement": "2^sqrt(2)"}, "g": {"name": "Golden Angle"}, From 6f2e9277fd2da059213354cdac86eb4a2fc8899e Mon Sep 17 00:00:00 2001 From: Katarzyna Rachwal Date: Fri, 9 Feb 2024 14:34:01 -0500 Subject: [PATCH 4/5] missed spacing in a file... --- react-frontend/src/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/react-frontend/src/index.tsx b/react-frontend/src/index.tsx index 032464f..71e9103 100644 --- a/react-frontend/src/index.tsx +++ b/react-frontend/src/index.tsx @@ -8,9 +8,9 @@ const root = ReactDOM.createRoot( document.getElementById('root') as HTMLElement ); root.render( - - - + + + ); // If you want to start measuring performance in your app, pass a function From 31178a83e6aba35916c08af5076f508b97c587ac Mon Sep 17 00:00:00 2001 From: Katarzyna Rachwal Date: Fri, 9 Feb 2024 14:40:25 -0500 Subject: [PATCH 5/5] and two more... --- react-frontend/src/App.tsx | 20 ++++++++++---------- react-frontend/src/reportWebVitals.tsx | 18 +++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/react-frontend/src/App.tsx b/react-frontend/src/App.tsx index 0acfdd5..c702af2 100644 --- a/react-frontend/src/App.tsx +++ b/react-frontend/src/App.tsx @@ -3,17 +3,17 @@ import './App.css'; import Form from './components/Form'; function App() { - return ( -
-
+ return ( +
+
The Ramanujan Machine -
using algorithms to discover new mathematics
-
-
-
-
-
- ); +
using algorithms to discover new mathematics
+
+
+
+
+
+ ); } export default App; diff --git a/react-frontend/src/reportWebVitals.tsx b/react-frontend/src/reportWebVitals.tsx index 49a2a16..d95c0a6 100644 --- a/react-frontend/src/reportWebVitals.tsx +++ b/react-frontend/src/reportWebVitals.tsx @@ -1,15 +1,15 @@ import { ReportHandler } from 'web-vitals'; const reportWebVitals = (onPerfEntry?: ReportHandler) => { - if (onPerfEntry && onPerfEntry instanceof Function) { - import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); - } + if (onPerfEntry && onPerfEntry instanceof Function) { + import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { + getCLS(onPerfEntry); + getFID(onPerfEntry); + getFCP(onPerfEntry); + getLCP(onPerfEntry); + getTTFB(onPerfEntry); + }); + } }; export default reportWebVitals;