csquinn0
csquinn0

Reputation: 11

Wolfram Mathematica is returning an incorrect derivative for the function (16x-4^x)/2x

In Mathematica, I open a new notebook and define the function f(x) as:

f[x_]=((16x-4^x)/2x)

Then, I calculate the derivative with the command:

f'[x]

This returns the following:

1/2 (-4^x + 16 x) + 1/2 x (16 - 4^x Log[4])

I believe this answer to be incorrect. After using Desmos, multiple online calculators, and my own calculations, I've determined f'(x) is actually

(-ln(2)*2^(2 x + 1) x + 4^x)/2 x^2

At first, I was confused about the inclusion of Log[4] instead of Ln[4] in Mathematica, but that portion is actually correct. When no base is specified for the Log function, it defaults to base e, which is equivalent to ln. Other than that, however, I've come to no conclusions as to why Mathematica is incorrect. I'm not sure if this problem stems from a misinterpretation of Calculus, or from an error in my code. I spoke to a trusted calculus teacher, and she agreed with my method, so I'm leaning towards the latter.

Upvotes: 0

Views: 385

Answers (2)

csquinn0
csquinn0

Reputation: 11

After further review from a friend, we determined my issue. The code provided is correctly executed, I just wrote my original function incorrectly. What I meant to write was:

f[x_]=((16x-4^x)/(2x))

So this was an error of me not understanding the output, rather than the program outputting incorrectly

Upvotes: 0

John
John

Reputation: 7339

You are not defining f correctly. When you enter u/2x that is the same as u / 2 * x which is not the same as u / (2x). Order of operations is important to know. If you define f correctly Mathematica will give you the derivative you expect.

Upvotes: -1

Related Questions