# Finding terms with derivatives

Posted 9 years ago
3419 Views
|
5 Replies
|
2 Total Likes
|
 Hi I have a list of equations eqns={lhs1==rhs1,lhs2==rhs2,...} I want to find those equations containing terms using the derivative operator ('). Could this be done??Thanks in advance. J. Rico
5 Replies
Sort By:
Posted 9 years ago
 Isaac Thanks for the several alternatives. They work very well! Jesus
Posted 9 years ago
 (* Mathematica 7, Compact code. *) (* Substitute without quotes, "Derivative" for all derivatives, " _' " for first derivative, " _'' " for second derivative etc.*) Take[ eqns, {#}]& /@ (Flatten[ Take[#, 1]& /@ Position[ eqns, #]])& /@ {_''''(* <--- User substitutions here.*)} 
Posted 9 years ago
 Isaac, In your code for finding specific derivatives specificD = Position[ eqns,#]& /@ { _'''} (* Find positions. *); the result is a list of positions. How can I use them to extract the actual derivative e.g. x'[t]. The positions are lists and when I give them as arguments of [[...]] the result is not the expected. This may be a silly question, sorry!
Posted 9 years ago
 I have solved the problem with extractÂ… sorry for the silly question.Thanks!Jesus
Posted 9 years ago
 (* Mathematica 7 *) (* Clear memory *) Clear["Global*"]; (* Define a list of equations. *) eqns = {x == 2y, x'[t] == 2t, x''[t] == 4t +1, y'[s] == 2z, y == t, y[m] == 2m, g[t] == x'[t]} (* To find all equations with any derivative. *) anyD = Position[ eqns, Derivative] (* Find positions. *); pos = Take[#, 1][[1]]& /@ anyD (* Isolate first "address" element. *); disp = Take[ eqns, {#}]& /@ pos (* Print out all eqns with any derivative. *) (* To find equations with a specified derivative. *) specificD = Position[ eqns,#]& /@ { _'''} (* Find positions. *); pos = Take[#, 1][[1]]& /@ specificD[[1]] (* Isolate the "address" element. *); disp = Take[ eqns, {#}]& /@ pos (* Print out the equations. *) `
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.