From ccfa2dc8cec38d17c000136ebb39cbe965e41367 Mon Sep 17 00:00:00 2001
From: Martin Putzlocher
Date: Thu, 16 Jan 2025 01:23:58 +0100
Subject: [PATCH] work on multiplication begins
---
aufgabengenerator_formulas_fraction_new_c.py | 18 ++++++++++++++----
formulas_fraction_addition_quiz.xml | 4 ++--
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/aufgabengenerator_formulas_fraction_new_c.py b/aufgabengenerator_formulas_fraction_new_c.py
index 0e4037f..84d3038 100644
--- a/aufgabengenerator_formulas_fraction_new_c.py
+++ b/aufgabengenerator_formulas_fraction_new_c.py
@@ -17,7 +17,8 @@ ops = {
# Anzahl der zu generierenden Fragen.
NUM_QUESTIONS = 5
# Algebraische Struktur der Aufgaben
-STRUCTURE = "(+)-((+)-(+))"
+#STRUCTURE = "(+)-((+)-(+))"
+STRUCTURE = "*"
# Gleiche Nenner erlauben
SAME_ALLOWED = True
# Größter Zähler
@@ -286,6 +287,15 @@ def create_formula_question(ex_number: int):
elif has_minus:
expression_type = "Subtraktion" + f" ({STRUCTURE})"
exercise_text = "Subtrahiere die Brüche"
+ elif has_mult and has_div:
+ expression_type = "Punktrechnung" + f" ({STRUCTURE})"
+ exercise_text = "Berechne den Term"
+ elif has_mult:
+ expression_type = "Multiplikation" + f" ({STRUCTURE})"
+ exercise_text = "Multipliziere die Brüche"
+ elif has_div:
+ expression_type = "Division" + f" ({STRUCTURE})"
+ exercise_text = "Dividiere die Brüche"
else:
expression_type = "Rechnung" + f" ({STRUCTURE})"
exercise_text = "Berechne den Term"
@@ -456,7 +466,7 @@ def create_formula_question(ex_number: int):
latex_calculation = gen_latex_calculate_string(STRUCTURE_PH, fractions_latex_strings)
sub_q_t_begin = "Berechne:
"
- sub_q_t_math = "\$\\Large \\displaystyle " + f"{latex_calculation}" + "=\$
"
+ sub_q_t_math = "\(\\Large \\displaystyle " + f"{latex_calculation}" + "=\)
"
rows_list = [
["Zähler:", "{_0}"],
["Nenner:", "{_1}"]
@@ -490,11 +500,11 @@ def create_formula_question(ex_number: int):
if shortable:
feedback_text = '''Lösungshinweis
Die korrekte Lösung ist:
- \$\\displaystyle''' + f"{latex_calculation}" +" = " + f"{expanded_latex_calculation}" + ''' = \\frac{{resnum}}{{cd}} = \\frac{{sresnum}}{{sresden}} \$
]]>'''
+ \(\\displaystyle''' + f"{latex_calculation}" +" = " + f"{expanded_latex_calculation}" + ''' = \\frac{{resnum}}{{cd}} = \\frac{{sresnum}}{{sresden}} \)
]]>'''
else:
feedback_text = '''Lösungshinweis
Die korrekte Lösung ist:
- \$ \\displaystyle ''' + f"{latex_calculation}" +" = " + f"{expanded_latex_calculation}" + ''' = \\frac{{resnum}}{{cd}} \$
]]>'''
+ \( \\displaystyle ''' + f"{latex_calculation}" +" = " + f"{expanded_latex_calculation}" + ''' = \\frac{{resnum}}{{cd}} \)
]]>'''
ET.SubElement(feedback_elem, 'text').text = feedback_text
# correctfeedback
diff --git a/formulas_fraction_addition_quiz.xml b/formulas_fraction_addition_quiz.xml
index afb316a..67b75c1 100644
--- a/formulas_fraction_addition_quiz.xml
+++ b/formulas_fraction_addition_quiz.xml
@@ -1,7 +1,7 @@
Addition von 2 ungleichnamigen Brüchen 0<![CDATA[ <p>Addiere die Brüche und kürze das Ergebnis so weit wie möglich.</p>
- <p>{#A} </p> ]]> 1.00000000.33333330 <![CDATA[ <p>Die Antwort ist richtig.</p> ]]> <![CDATA[ <p>Die Antwort ist teilweise richtig.</p> ]]> <![CDATA[ <p>Die Antwort ist falsch.</p> ]]> n = [5, 3];
- d = [9, 6];ABCD0#A102g = gcd(d[0],d[1]);
+ <p>{#A} </p> ]]> 1.00000000.33333330 <![CDATA[ <p>Die Antwort ist richtig.</p> ]]> <![CDATA[ <p>Die Antwort ist teilweise richtig.</p> ]]> <![CDATA[ <p>Die Antwort ist falsch.</p> ]]> n = [8, 8];
+ d = [4, 10];ABCD0#A102g = gcd(d[0],d[1]);
cd = d[0]*d[1]/pow(g,2);
e = [cd / d[0], cd / d[1]];
nums = [n[0]*e[0], n[1]*e[1]];