Skip to content

Commit 84ebde4

Browse files
committed
add wolfram alpha button
1 parent 345b3dc commit 84ebde4

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

circuitSolver/modules/main.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,17 @@ function TransformResults(props) {
388388
}}>
389389
Copy MathML
390390
</button>
391+
<button
392+
type="button"
393+
className="btn btn-outline-primary py-0"
394+
onClick=${() => {
395+
// const newLatex = MathML2LaTeX.convert(mathMlString);
396+
var encoded_latex = encodeURIComponent(props.resString);
397+
var newURL = `https://www.wolframalpha.com/input?i2d=true&i=${encoded_latex}`
398+
window.open(newURL, '_blank');
399+
}}>
400+
Wolfram Alpha
401+
</button>
391402
</div>
392403
</div>`
393404
: html`<button
@@ -1050,6 +1061,7 @@ class Game extends React.Component {
10501061
iprbList=${this.state.iprbList}
10511062
copiedToast=${this.copiedToast}
10521063
copiedToastML=${this.copiedToastML}
1064+
resString=${this.resString}
10531065
handlePlotChange=${(e) => this.handlePlotChange(e)}
10541066
chosen=${this.state.chosenPlot} />
10551067

circuitSolver/modules/mna.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,16 @@ export function calculateMNA(canvasState, chosenPlot) {
313313
//Remove eval: 35ms
314314
//Remove simplify: 15ms
315315
var strOut = Algebrite.eval("mna_vo_vi").toString(); //4ms
316-
316+
317317
// if (iprbNode!=null) console.log('iprb result', Algebrite.eval("iprb").toString() );
318318

319319

320320

321321

322-
[resString, resMathML] = simplify_algebra(strOut);
322+
var xyz= simplify_algebra(strOut);
323+
resString = xyz[0]
324+
resMathML = xyz[1]
325+
// [resString, resMathML] = simplify_algebra(strOut);
323326
schematicReadiness.solvable = true;
324327
} catch (err) {
325328
console.log("Solving failed with this error:", err);

0 commit comments

Comments
 (0)