## 0 Reputation

7 years, 171 days

## Maple numeric evaludation wrongly?...

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:="[itex]<cn>\${#answer}</cn>[/itex]"; expr2:="[itex]<cn>\${#correctAnswer}</cn>[/itex]"; expr3:="[itex]<cn>\${#tolrence}</cn>[/itex]";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:="[itex]<cn>10d</cn>[/itex]"; expr2:="[itex]<cn>10</cn>[/itex]"; expr3:="[itex]<cn>0</cn>[/itex]";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 := "[itex]<cn>10d</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr3 := "[itex]<cn>0</cn>[/itex]" expr1 := "[itex]<cn>10d</cn>[/itex]" expr1 := "[itex]<cn>10d</cn>[/itex]" expr1 := "[itex]<cn>10d</cn>[/itex]" expr1 := "[itex]<cn>10d</cn>[/itex]" expr1 := "[itex]<cn>10d</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr1 := 10. expr2 := 10 expr := 0. expr3 := 0 result := true result := true result := true

mapleScript :: (user input) 10
expr1:="[itex]<cn>10</cn>[/itex]"; expr2:="[itex]<cn>10</cn>[/itex]"; expr3:="[itex]<cn>0</cn>[/itex]";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 := "[itex]<cn>10</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr3 := "[itex]<cn>0</cn>[/itex]" expr1 := "[itex]<cn>10</cn>[/itex]" expr1 := "[itex]<cn>10</cn>[/itex]" expr1 := "[itex]<cn>10</cn>[/itex]" expr1 := "[itex]<cn>10</cn>[/itex]" expr1 := "[itex]<cn>10</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr2 := "[itex]<cn>10</cn>[/itex]" expr1 := 10 expr2 := 10 expr := 0 expr3 := 0 result := true result := true result := true```
 Page 1 of 1
﻿