I need to do the following:
- Define a function
- Take the derivative of this function and have a look at the symoblic representation
- Substitute in some values
With the bonus that I want to use the correct variable names everywhere to not mess up my head. So I have defined:
a = 0.04; L1 = 1; L0 = 1; My function being
L[s_, L0_, L1_, a_] := L1 + L0/(1 + s/a); I don't know how to easily take the derivative of this expression when the arguments are defined (and I don't want to make up new variable names). The best way I could find was using module, like this:
Module[{s, L0, L1, a}, D[L[s, L0, L1, a], s]] But this had an unexpected result,
$-\frac{\text{L0$\$$7293}}{\text{a$\$$7293} \left(1+\frac{\text{s$\$$7293}}{\text{a$\$$7293}}\right)^2}$
I can't figure out where $7293 comes from? Also, is there a better way, perhaps a way so that I don't have to specify the variables I want to localize? Just telling Mathematica, "do this symbolically".


D[L[s, L0, L1, a], s]is sufficient becauseshas no value. Or do you mean don't want to substitute in the values forL0, etc. at all? In that case I suggest you don't give them values. Make a rule list insteadpars = {a -> 0.04, L1 -> 1, L0 -> 1}, and doexpr /. parswhen you need to substitute them intoexpr. $\endgroup$