Understanding How a Program Is Treating Parentheses

01112018, 09:13 PM
Post: #1




Understanding How a Program Is Treating Parentheses
Hi there,
I'm trying to make a simple program to return an expression for the curvature of a single variable function in X. My intention would be to execute this in the home view and plot the result. Code: EXPORT CurvX(EX) For a lot of functions this works just fine, but if I try it on the exponential function, I get some unexpected behavior. When textbook display is enabled, the result seems exactly as expected, but once I copy it back to input, the (e^X)^2 term becomes e^(X)^2. If I disable textbook display, we see that the function is actually returning e^(X)^2, which, strictly speaking, represents e^(X^2) instead of the desired e^(2X). If I evaluate the copied expression, you can even see that the extra parentheses are inserted afterwards to reflect this parsing: I'm pretty sure the problem lies in the way my program is evaluating the return expression, but I'm unaware of how it should be written to ensure parentheses are always included before squaring the derivative. Any insight would be much appreciated! Thanks 

« Next Oldest  Next Newest »

Messages In This Thread 
Understanding How a Program Is Treating Parentheses  kvloxx  01112018 09:13 PM

User(s) browsing this thread: 1 Guest(s)