您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Free mathematics learning companion for Mathspace
当前为
// ==UserScript== // @name TutorMe By U.K - Mathspace Helper // @namespace http://tampermonkey.net/ // @version 1.0 // @description Free mathematics learning companion for Mathspace // @author U.K // @match https://*.mathspace.co/* // @grant none // ==/UserScript== (function() { 'use strict'; // ... keep existing code (styles and UI setup until calculator handling) // Handle calculator with proper exponent calculation calcButton.addEventListener('click', () => { try { let expression = calcInput.value; // Handle exponents (^) before evaluation if (expression.includes('^')) { expression = expression.replace(/(\d+)\s*\^\s*(\d+)/g, (match, base, exponent) => { return Math.pow(parseFloat(base), parseFloat(exponent)); }); } const result = new Function('return ' + expression)(); calcResult.textContent = `Result: ${result}`; } catch (error) { calcResult.textContent = 'Error: Invalid expression'; } }); // Enhanced problem analysis function function analyzeMathProblem(question) { // Identify problem type const problemTypes = { algebraic: /[xy]\s*=|solve|equation|expression/i, geometric: /area|perimeter|volume|triangle|circle|square/i, arithmetic: /add|subtract|multiply|divide|\+|\-|\*|\/|\^/i, calculus: /derivative|integral|limit|differentiate|integrate/i }; let problemType = 'general'; for (const [type, pattern] of Object.entries(problemTypes)) { if (pattern.test(question)) { problemType = type; break; } } // Generate detailed solution steps based on problem type let steps = []; switch (problemType) { case 'algebraic': steps = [ "Step 1: Identify the variables and their relationships", "Step 2: Isolate the variable on one side of the equation", "Step 3: Simplify both sides", "Step 4: Solve for the variable", "Step 5: Verify the solution" ]; break; case 'geometric': steps = [ "Step 1: Identify the geometric shapes involved", "Step 2: List relevant formulas", "Step 3: Identify given measurements", "Step 4: Apply appropriate formulas", "Step 5: Calculate the final answer" ]; break; case 'arithmetic': steps = [ "Step 1: Order of operations (PEMDAS)", "Step 2: Simplify expressions within parentheses", "Step 3: Calculate exponents (powers)", "Step 4: Perform multiplication and division (left to right)", "Step 5: Perform addition and subtraction (left to right)" ]; break; case 'calculus': steps = [ "Step 1: Identify the calculus concept involved", "Step 2: Write out relevant formulas/rules", "Step 3: Apply differentiation/integration rules", "Step 4: Simplify the expression", "Step 5: Check the solution" ]; break; default: steps = [ "Step 1: Read and understand the problem carefully", "Step 2: Identify key information and unknowns", "Step 3: Choose appropriate mathematical methods", "Step 4: Solve step by step", "Step 5: Verify the answer makes sense" ]; } return { type: problemType, steps: steps, explanation: `This is a ${problemType} problem. Let's solve it step by step:\n\n` + steps.join('\n\n') + '\n\nApplying these steps to your specific problem...' }; } // Update the click handler for the analyze button analyzeBtn.addEventListener('click', async () => { const question = questionText.textContent; if (question === 'Waiting for question...') return; analyzeBtn.textContent = 'Analyzing...'; analyzeBtn.disabled = true; try { const analysis = analyzeMathProblem(question); solutionDiv.style.display = 'block'; solutionDiv.textContent = analysis.explanation; } catch (error) { solutionDiv.textContent = "Error analyzing question. Please try again."; } finally { analyzeBtn.textContent = 'Analyze Question'; analyzeBtn.disabled = false; } }); // ... keep existing code (rest of the event handlers and observer) })();