Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
fl2on authored Jul 6, 2024
1 parent ccf0920 commit 4d2db14
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Js/mobile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
document.getElementById('calculate').addEventListener('click', function() {
const expression = document.getElementById('expression').value;
const variable = document.getElementById('variable').value;

try {
let result;
let formattedExpression = `\\(${expression}\\)`;
let formattedResult;

result = math.derivative(expression, variable).toString();
formattedResult = `\\(${math.parse(result).toTex()}\\)`;

document.getElementById('result').innerHTML = `<strong>Función:</strong> ${formattedExpression}<br><strong>Resultado:</strong> ${formattedResult}`;
MathJax.typeset();
} catch (error) {
document.getElementById('result').innerHTML = `<strong>Error:</strong> ${error.message}`;
}
})

0 comments on commit 4d2db14

Please sign in to comment.