After learning and reprograming the code for most of the year,I meet a problem in the "parser.c" file :
After reading the whole code line-by-line，I didn't find any problem with the
"int evaluate (char *s, double *r)" function,which transform the string-typed boundary condition into the concrete data under the "void SetBoundary ()" function. But,in practice,when the imput boundary parameters include the 'sin(x)' or ‘sqrt(x)’, the program cannot get the corresponding right boundary data.However ,when the boundary parameters include the 'cos(x-pi/2)' or ‘abs(x)’, the program do get the corresponding right boundary condition.
Do you know how to solve this problem?
Thanks for your patience to read through my questions!
Your reply is deeply-appreciated!
There was a bug parsing expression starting with 's' because this was a name of a variable. I think I have resolved this issue. The problem was that it first detected the 's' char as variable and then wouldn't recognize it was a function.
I have included a new function to detect if it is variable or not by checking if next char is an operator, space or end line.
However, I haven't tested this thoroughly. You can get latest version from SVN repository.
Thank you for your kind answering and prompt reply.I greatly admire your outstanding capability from the bottom of my heart.
Log in to post a comment.