Check if the answer answers from a specific form, such as form A *% e ^ ββ(B * t)
I want to check if the input of a particular form has any maximum. For example, I want to check if the answer is in the form A*%e^(B*t)
where A and B are specific real numbers.
If student X gives an answer 3*%e^(5*t)
, then he has this form. If student Y gives an answer, sin(t)
or maybe y=3*%e^(5*t)
I can give this student feedback that his answer is not yet in the correct form.
I was wondering if something like this exists in the highs.
source to share
Maxima has several pattern matching functions that operate on expressions (not strings). I think defmatch
it fits here, for example:
(%i8) matchdeclare ([A, B], constantp);
(%o8) done
(%i9) defmatch (match_aexpbt, A*exp(B*t), t);
(%o9) match_aexpbt
(%i10) match_aexpbt (5*exp(3*u), u);
(%o10) [A = 5, B = 3, t = u]
(%i11) match_aexpbt (sqrt(2)*exp(%pi*z), z);
(%o11) [A = sqrt(2), B = %pi, t = z]
(%i12) match_aexpbt (y = 5*exp(3*u), u);
(%o12) false
(%i13) match_aexpbt (5*sin(2*u), u);
(%o13) false
(%i14) match_aexpbt ((1 + %i)*exp(exp(%pi)*v), v);
%pi
(%o14) [A = %i + 1, B = %e , t = v]
In this case, I've defined match_aexpbt
which matches the expressions that look like A*exp(B*t)
, where A
and B
are constants, and t
is the variable that is provided.
See the documentation for defmatch
and matchdeclare
, and defrule
, tellsimp
and tellsimpafter
. The pattern matching functions are a little different, but actually very useful - I've used them many times.
If you're interested in verifying student responses, Maxima-based projects have been created for this. Take a look at the related projects web page ( http://maxima.sourceforge.net/relatedprojects.html ) and see STACK in particular ( http://stack.bham.ac.uk/ ).
source to share