TransWikia.com

How to extract the argument from an in-built function

Mathematica Asked by Riccardo on January 24, 2021

I would like to extract the argument from :

DiracDelta[-10 + x + ξ]

3 Answers

You can use Part to access the parts of any normal expression.

DiracDelta[-10 + x + ξ][[1]]
(* -10 + x + ξ *)

In this case you can also use First since you want the first part.

Another common need is to pull out the arguments of a function when that function is buried in a larger expression. For this you can use Cases

Cases[
 {w''[z] + k^2 w[z] == DiracDelta[z], w[0] == 0, w'[0] == 1},
 DiracDelta[arg_] :> arg, Infinity]
(* {z} *)

Answered by Jason B. on January 24, 2021

DiracDelta[-10 + x + [Xi]] /. DiracDelta -> " "

or (as @JasonB wrote):

First@DiracDelta[-10 + x + [Xi]] 

Answered by David G. Stork on January 24, 2021

What about

DiracDelta[-10 + x + [Xi]] /. DiracDelta -> Identity
(**)

More generally(also works for several arguments)

 Apply[List ,DiracDelta[-10 + x + [Xi]] ]

Answered by Ulrich Neumann on January 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP