-1
$\begingroup$

I'm trying to evaluate the exact solution of heat diffusion in circular plate.

I'm not able to use the natural logarithm inside expression.

from math import log as ln

u_e = Expression("ln(5)")

The above line doesn't work. Could anyone help me with the correct syntax?

$\endgroup$
1
$\begingroup$

Double quotes(" ") represent strings in python, and hence the argument of the function Expression() is a string literal rather than a floating-point number, i.e., ln(5). To correctly specify ln(5) as an argument, remove the double-quotes.

$\endgroup$
1
$\begingroup$

Or simply

import math

u_e = Constant(math.log(5))
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.