MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to evaluate the Laplacian of a function as a function?

Am 01.12.2010 08:15, schrieb Iliyan Georgiev:
> Hi,
> I have a stupid problem and cannot find a solution anywhere. I have
> the function
> func[x_,y_] := 3/Pi*(1 - x^2 + y^2))^2
> which I need the Laplacian of:
> funcLapl := Laplacian[func[Xx,Yy]]
> The Laplacian is computed correctly, but how can I treat the result as
> a function? I want to be able to evaluate/plot the Laplacian. I tried
> many things and I'm frustrated. My current solution is to manually
> copy the derived Laplacian and create a function from that. It's
> obviously not a good solution.

For expressions, map second derivatives of expression into varaibel 
list, convert the list to a sum and the pair of variable list and body 
into a Function

LaplaceOperator[expr_, x_List]:=
ff[ x, Plus@@ (D[expr,#,#]&/@x))] /. ff->Function

Another way to force evaluation inside a function body during body 
preprocessing is using Evaluate

LaplaceOperator[expr_, x_List] :=
  Function[x, Evaluate[Plus @@ (D[expr, #, #] & /@ x)]]


Roland Franzius

  • Prev by Date: Re: Replacement Rule with Sqrt in denominator
  • Next by Date: Re: multiple outputs from compiled function
  • Previous by thread: Re: How to evaluate the Laplacian of a function as a function?
  • Next by thread: Re: Cuda offline installation in M8