Natural Log Answer Check

How can I get the CL to check a natural log answer and give them a check? This is for a regular log, but I want the answer to be “ln22026.47=10”.

Here is the code that worked for a log base 11:
check1a = numericValue(parseEquation(this.latex).rhs) = numericValue(parseEquation(this.latex).lhs) and countNumberUsage(this.latex,11)=1 and countNumberUsage(this.latex,1331)=1 and countNumberUsage(this.latex,3)=1

disableEvaluation: true

We tried to understand your question … but we were not able to.
Can you please give some more details?
Why do you count the occurrences of 1331 = 11^3 … ?

I’m not sure actually. I found that online to use for logs with bases other than 10.

countNumberUsage() can be used to (1) identify number of occurrences of numbers (not digits) in an input, and (2) occurrences of a specified number (i.e. the second argument).

countNumbers = countNumberUsage(this.latex)
count10 = countNumberUsage(this.latex, 10)

Since there isn’t a logarithm pattern to parse the base and argument, the CL used for the other example is ensuring “11”, “1331”, and “3” were each used once in the answer. There should probably be an evaluative check as well, like:

checkEquiv = parseEquation(this.latex).differenceFunction(``).evaluateAt(0) = 0

This still doesn’t differentiate between 1331=11^{3} and \log_{11}(1331)=3, but you can see if there’s a functionCall present:

p = patterns
parseEq = parseEquation(this.latex)
#checks each side of the equation for a function ( log in this example )
hasFunction = p.contains(p.functionCall).matches(this.latex)
1 Like

Here’s a solution a colleague shared.