Why does Mathematica's derivative differ from mine for f[x] = (ax+b)/(2x+d)?

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 6K views
ktpr2
Messages
189
Reaction score
0
I have

f[x_] := ax+b/2x+d
f'[x]

and I get

-2(ax+b)/(d+2x)^2

instead of

ad-2b/(d+2x)^2

Assuming the above, my answer, is correct, why does mathemetica give me its answer? Is it interpreting one of the variables as some kind of weird constant?
 
Physics news on Phys.org
no one has any idea what might be wrong?
 
You're not using parentheses properly. The / operator has a higher precedence than the + operator. Try:

f[x_] := (ax+b)/(2x+d)

- Warren
 
Oops, nevermind. The problem is that Mathematica thinks "ax," without spaces, is a variable unto itself, different from either a or x. You need to use either spaces or the * operator to indicate multiplication:

f[x_] := (a*x+b)/(2x+d)

- Warren
 
Which answer is yours and which answer is mathematica's.

The answer I get is the ad-2b/(d+2x)^2, the -2(ax+b)/(d+2x)^2 comes from doing only half of the quotient rule equation.

EDIT: Or just follow the advice above :-p
 
Last edited:
that makes sense. thanks a lot. I'm seeing how delicate things have to be formated. For instance, I just ran into another thing where I realized that my trig functions have to have bracketed variable inputs (Cos [x]) as opposed to Cos (x) which is something else.