From e0abd45dc194f7ede2b460c6e9c2c303d4321bd7 Mon Sep 17 00:00:00 2001 From: Jean-Michel Vedrine Date: Sun, 24 Jan 2016 13:18:38 +0100 Subject: Solve display using MathJax for all websites --- parser.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'parser.php') diff --git a/parser.php b/parser.php index 6a81fe6..8a21bc3 100644 --- a/parser.php +++ b/parser.php @@ -1336,10 +1336,20 @@ class qtype_algebra_parser_bracket extends qtype_algebra_parser_term { * @return the numerical value of the term given the provided values for the variables */ function evaluate($params) { + if($this->_sign=='-') { + $mult=-1; + } else { + $mult=1; + } if(count($this->_arguments)!=$this->_nargs) { return 0; } - return $this->_arguments[0]->evaluate($params); + return $mult*$this->_arguments[0]->evaluate($params); + } + + function set_negative() { + // Set the sign to be a '-' + $this->_sign='-'; } /** -- cgit v1.2.3