Hi folks,
how i assign the result of the derivation as new function?
Clear[lx]
lx[x[t], phi[t], l, t] := x[t] + l*Sin[phi[t]]
D[lx[x[t], phi[t], l, t], t]
dlx[x[t], x´[t], phi[t], phi´[t], l, t] = %
many thanks
john
Hi folks,
how i assign the result of the derivation as new function?
Clear[lx]
lx[x[t], phi[t], l, t] := x[t] + l*Sin[phi[t]]
D[lx[x[t], phi[t], l, t], t]
dlx[x[t], x´[t], phi[t], phi´[t], l, t] = %
many thanks
john
Hi Johannes,
how about this:
ClearAll["Global`*"]
lx[x_[t_], phi_[t_], l_] := x[t] + l*Sin[phi[t]]
dlx[dx_[t_], phi_[t_], dphi_[t_], l_] = (D[lx[x[t], phi[t], l], t] /. {x' -> dx, phi' -> dphi})
Regards – Henrik
many thanks Henrik,
working perfect! May, you could tell me what /. means? Or in other words why do I need to write this in that way? Why, I cannot just specifiy the variable in the function x’?
kind regrads
Johannes
Hi Johannes,
Mathematica has an excellent documentation:
ReplaceAll (Built-in Wolfram Language Symbol)
expr /. rules applies a rule or list of rules in an attempt to transform each subpart of an expression expr. ReplaceAll[rules] represents an operator form of ReplaceAll that …
The reason why I did it this way was that x' is not just a function, but a function acting on a function:
x' // FullForm
(* Out: Derivative[1][x] *)
You can define those properties of x e.g. like so (i.e. using UpValues):
x /: Derivative[1][x] = Sin;
or
Derivative[1][x] ^= Sin;
but I can not see how to use this in this context.
Regards – Henrik