last day (15 days later) » 

15:22
0
Q: In a list, how to pick whatever is not f and it's derivatives?

Red BananaSuppose I have a list like: list1 = {{f[x], Sin[x]}, {f'[x]}, {f''[x]}}; list2 = {{f[x]}, {Cos[x], f''[x]}}; Code: {{f[x], Sin[x]}, {Derivative[1][f][x]}, {(f^\[Prime]\[Prime])[x]}} {{f[x]}, {Cos[x], (f^\[Prime]\[Prime])[x]}} I want to create a Listable function that picks, whatever is not f...

bmf
bmf
Very respectfully, but a member for 11 years posting an image instead of properly formatted code is not good for newer members...
@bmf I was going to post the code, but it gets a kinda unreadable. With lots of [Prime], etc.
@bmf Done. $$$$
bmf
bmf
I had already done it for you. it's the code about the image. but thanks for taking the time to edit :-)
As a comment to the task at hand: since you are dealing with lists, is it not easier to set the function and its derivatives to zero and drop zeroes from the list? Something like DeleteCases[list1 /. f -> (0 &) /. 0. -> 0 // Flatten, 0]?
@bmf No, I need the f's.
bmf
bmf
hello there, in the statement of the OP you wrote "that picks, whatever is not f[x] and it's derivatives"
DeleteCases[{{f[x], Sin[x]}, {f'[x]}, {f''[x]}} /. f -> (0 &) /.
0. -> 0 // Flatten, 0]
picks the only thing that is not f[x] or its derivatives which is Sin[x]
did I misunderstand?
yes, I did. sorry. it's obviously getting too late here. I deleted my comments to avoid spamming your OP
15:26
Same confusion here. So far I have: `DeleteCases[#, f[__] | Derivative[_][f][x], {2}] /. {} ->
Nothing & /@ {list1, list2}`
bmf
bmf
@Syed it is possible that this is a typo in the OP from the discussion here
probably something like: pick whatever is f and its derivatives
otherwise our solutions do the trick with yours preserving the structure since you don't Flatten
Let the OP clarify then. The details can be added to the post when available.
bmf
bmf
@Syed yup. agreed :-)

last day (15 days later) »