Kumar M R

0 Reputation

2 Badges

7 years, 171 days

MaplePrimes Activity


These are questions asked by Kumar M R

 

We are using your maple service and required your help in solving below problem '
1. Create a question type Maple Numeric with correct answer 27
2. If user gives 27d and 27e and on evaluate with your service getting response as true.

Please find the attached screens for more information. Also see request and response for numeric value 10 and if you see response even 10d is evaluating as true. This is wrong, please review and advice.

-------------------

mapleScript :: before substitution

expr1:="<math><cn>${#answer}</cn></math>"; expr2:="<math><cn>${#correctAnswer}</cn></math>"; expr3:="<math><cn>${#tolrence}</cn></math>";expr1 := StringTools[SubstituteAll](expr1, ",", "");expr1 := StringTools[RegSubs]("<apply>< *([a-zA-Z]+)[ /]*>" = "<apply><ci>\1</ci>", expr1);expr1 := StringTools[RegSubs]("<apply><ci>(plus|minus|divide|times|power)</ci>" = "<apply><\\1/>", expr1);expr1 := StringTools[RegSubs]("<apply><ci> *([a-zA-Z]+) *</ci>" = "<apply><ci>x_\\1</ci>", expr1);expr1 := StringTools[RegSubs]("<c[ni]> *([0-9]+\\.[0-9]+) *</c[ni]>" = "<apply><ci>convert</ci><cn>\\1</cn><ci>rational</ci><ci>exact</ci></apply>", expr1);expr2 := StringTools[SubstituteAll](expr2, ",", "");expr2 := StringTools[RegSubs]("<apply>< *([a-zA-Z]+)[ /]*>" = "<apply><ci>\\1</ci>", expr2);expr2 := StringTools[RegSubs]("<apply><ci>(plus|minus|divide|times|power)</ci>" = "<apply><\\1/>", expr2);expr2 := StringTools[RegSubs]("<apply><ci> *([a-zA-Z]+) *</ci>" = "<apply><ci>x_\\1</ci>", expr2);expr2 := StringTools[RegSubs]("<c[ni]> *([0-9]+\\.[0-9]+) *</c[ni]>" = "<apply><ci>convert</ci><cn>\\1</cn><ci>rational</ci><ci>exact</ci></apply>", expr2);expr1 := MathML[ImportContent](expr1);expr2 := MathML[ImportContent](expr2);expr := combine(expr1-expr2, [radical,power,trig,ln,power,radical], symbolic);expr3:=MathML[ImportContent](expr3);result := evalb(abs(simplify(expr, symbolic))<=expr3);result := evalb(result = true);if not result then result := evalb(abs(simplify(expr, assume = real))<=expr3) end if;result := evalb(result = true);

mapleScript :: (user input) 10d

expr1:="<math><cn>10d</cn></math>"; expr2:="<math><cn>10</cn></math>"; expr3:="<math><cn>0</cn></math>";expr1 := StringTools[SubstituteAll](expr1, ",", "");expr1 := StringTools[RegSubs]("<apply>< *([a-zA-Z]+)[ /]*>" = "<apply><ci>\1</ci>", expr1);expr1 := StringTools[RegSubs]("<apply><ci>(plus|minus|divide|times|power)</ci>" = "<apply><\\1/>", expr1);expr1 := StringTools[RegSubs]("<apply><ci> *([a-zA-Z]+) *</ci>" = "<apply><ci>x_\\1</ci>", expr1);expr1 := StringTools[RegSubs]("<c[ni]> *([0-9]+\\.[0-9]+) *</c[ni]>" = "<apply><ci>convert</ci><cn>\\1</cn><ci>rational</ci><ci>exact</ci></apply>", expr1);expr2 := StringTools[SubstituteAll](expr2, ",", "");expr2 := StringTools[RegSubs]("<apply>< *([a-zA-Z]+)[ /]*>" = "<apply><ci>\\1</ci>", expr2);expr2 := StringTools[RegSubs]("<apply><ci>(plus|minus|divide|times|power)</ci>" = "<apply><\\1/>", expr2);expr2 := StringTools[RegSubs]("<apply><ci> *([a-zA-Z]+) *</ci>" = "<apply><ci>x_\\1</ci>", expr2);expr2 := StringTools[RegSubs]("<c[ni]> *([0-9]+\\.[0-9]+) *</c[ni]>" = "<apply><ci>convert</ci><cn>\\1</cn><ci>rational</ci><ci>exact</ci></apply>", expr2);expr1 := MathML[ImportContent](expr1);expr2 := MathML[ImportContent](expr2);expr := combine(expr1-expr2, [radical,power,trig,ln,power,radical], symbolic);expr3:=MathML[ImportContent](expr3);result := evalb(abs(simplify(expr, symbolic))<=expr3);result := evalb(result = true);if not result then result := evalb(abs(simplify(expr, assume = real))<=expr3) end if;result := evalb(result = true);

evalResult ::
expr1 := "<math><cn>10d</cn></math>" expr2 := "<math><cn>10</cn></math>" expr3 := "<math><cn>0</cn></math>" expr1 := "<math><cn>10d</cn></math>" expr1 := "<math><cn>10d</cn></math>" expr1 := "<math><cn>10d</cn></math>" expr1 := "<math><cn>10d</cn></math>" expr1 := "<math><cn>10d</cn></math>" expr2 := "<math><cn>10</cn></math>" expr2 := "<math><cn>10</cn></math>" expr2 := "<math><cn>10</cn></math>" expr2 := "<math><cn>10</cn></math>" expr2 := "<math><cn>10</cn></math>" expr1 := 10. expr2 := 10 expr := 0. expr3 := 0 result := true result := true result := true

mapleScript :: (user input) 10
expr1:="<math><cn>10</cn></math>"; expr2:="<math><cn>10</cn></math>"; expr3:="<math><cn>0</cn></math>";expr1 := StringTools[SubstituteAll](expr1, ",", "");expr1 := StringTools[RegSubs]("<apply>< *([a-zA-Z]+)[ /]*>" = "<apply><ci>\1</ci>", expr1);expr1 := StringTools[RegSubs]("<apply><ci>(plus|minus|divide|times|power)</ci>" = "<apply><\\1/>", expr1);expr1 := StringTools[RegSubs]("<apply><ci> *([a-zA-Z]+) *</ci>" = "<apply><ci>x_\\1</ci>", expr1);expr1 := StringTools[RegSubs]("<c[ni]> *([0-9]+\\.[0-9]+) *</c[ni]>" = "<apply><ci>convert</ci><cn>\\1</cn><ci>rational</ci><ci>exact</ci></apply>", expr1);expr2 := StringTools[SubstituteAll](expr2, ",", "");expr2 := StringTools[RegSubs]("<apply>< *([a-zA-Z]+)[ /]*>" = "<apply><ci>\\1</ci>", expr2);expr2 := StringTools[RegSubs]("<apply><ci>(plus|minus|divide|times|power)</ci>" = "<apply><\\1/>", expr2);expr2 := StringTools[RegSubs]("<apply><ci> *([a-zA-Z]+) *</ci>" = "<apply><ci>x_\\1</ci>", expr2);expr2 := StringTools[RegSubs]("<c[ni]> *([0-9]+\\.[0-9]+) *</c[ni]>" = "<apply><ci>convert</ci><cn>\\1</cn><ci>rational</ci><ci>exact</ci></apply>", expr2);expr1 := MathML[ImportContent](expr1);expr2 := MathML[ImportContent](expr2);expr := combine(expr1-expr2, [radical,power,trig,ln,power,radical], symbolic);expr3:=MathML[ImportContent](expr3);result := evalb(abs(simplify(expr, symbolic))<=expr3);result := evalb(result = true);if not result then result := evalb(abs(simplify(expr, assume = real))<=expr3) end if;result := evalb(result = true);

evalResult ::
expr1 := "<math><cn>10</cn></math>" expr2 := "<math><cn>10</cn></math>" expr3 := "<math><cn>0</cn></math>" expr1 := "<math><cn>10</cn></math>" expr1 := "<math><cn>10</cn></math>" expr1 := "<math><cn>10</cn></math>" expr1 := "<math><cn>10</cn></math>" expr1 := "<math><cn>10</cn></math>" expr2 := "<math><cn>10</cn></math>" expr2 := "<math><cn>10</cn></math>" expr2 := "<math><cn>10</cn></math>" expr2 := "<math><cn>10</cn></math>" expr2 := "<math><cn>10</cn></math>" expr1 := 10 expr2 := 10 expr := 0 expr3 := 0 result := true result := true result := true
Page 1 of 1