Re: Calculus of variations

*To*: mathgroup at smc.vnet.net*Subject*: [mg20196] Re: Calculus of variations*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Tue, 5 Oct 1999 04:04:25 -0400*Organization*: Wolfram Research, Inc.*References*: <7suv87$21u@smc.vnet.net> <7t4ceh$829@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

WCamp92147 wrote: > > >here are many texts > >that discuss this problem. The ones I am familiar with are physics texts > >such a Goldstein's mechanics book > > > >Kevin > > I'm sorry about the misunderstanding, guess I wasn't clear in my original post. > I'm looking for a Mathematica-oriented book that deals with the calculus of > variations, in particular how to "teach" Mathematica Leibniz's rules for > differentiating integrals, and how to integrate by parts. The problem I am > considering doesn't seem to fit quite into the classical framework of the > calculus of variations, but I think would use similar techniques. I'll repeat > the problem of interest here: > > given two functions of a single > variable f1[x] and f2[x], which are 0 almost everywhere, find the > value of x0 such that Integrate[(f1[x]-f2[x+x0])^2,{x,-infinity, > infinity}] is minimized. > > Thanks for your response -- I had fogotten about the discussion in Goldstein, > which has gathered dust on my bookshelf for years. > Bill Campbell This does not fully address the question posted, but does give some idea for how one might do such minimization using Mathematica. One such method shown below does differentiate an integral with respect to a parameter, whic is at least along the lines requested above. I did not at first understand the question but, following clarification by private e-mail, we can proceed. We start with a pair of compactly supported functions. For a simple example: f1[x_?NumberQ] := If[0<x<2, 1-(x-1)^2, 0] f2[x_?NumberQ] := If[Pi/2<x<3/2*Pi, Cos[x]^2, 0] We wish to minimize g[y_] := Integrate[(f1[x] - f2[y-x])^2, {x,-Infinity,Infinity}] To begin, it might be useful to look at Plot[g[y], {y,2,6}]; You will see a dip just to the right of 4. As with the following, you will also obtain alot of warning messages about failures to converge and the like. They could perhaps be eradicated by redefinining g using NIntegrate and appropriate option tweaking. A quick way to find a minimizer for g is via FindMinimum. One needs to specify two starting points because the derivatives involved are not analytic. I start near 3 just to show that we do not need to begin too close to the minimizer. In[5]:= FindMinimum[g[y], {y,3,3.1}] [several NIntegrate warning messages removed] Out[5]= {0.0406353, {y -> 4.14159}} For a calculus of variations approach, one can differentiate the integral that defines g[y], set that to zero, and solve for y. var[y_] = D[g[y],y] In[13]:= FindRoot[Evaluate[var[y]]==0, {y,3.5,3.6}] [several NIntegrate warning messages removed] Out[13]= {y -> 4.14159} This method of using FindRoot is substantially slower. It is also much more sensitive to starting values and may take one to a maximizer instead of a minimizer (differential calculus can be funny that way). Daniel Lichtblau Wolfram Research

**Re: NonlinearRegress and numerical functions...**

**Re: Integer Assumptions in Integrations**

**Re: Calculus of variations**

**Re: Browser Safe Colors?**