Re: Using the solution of a differential equation and minimizing the solution.
- To: mathgroup at smc.vnet.net
- Subject: [mg60830] Re: Using the solution of a differential equation and minimizing the solution.
- From: dh <dh at metrohm.ch>
- Date: Thu, 29 Sep 2005 05:43:11 -0400 (EDT)
- References: <dhaui2$j1i$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, Question 1: Assuming, you have an interpolationg function in the range {a,b} and you want to determine a local minimum. This can be done e.g. with FindMinimum. It is a good idea to give FindMinimum the allowed range, to avoid that FindMinimum evaluates the interpolating function outside its range, resulting in warnings. Here is a simple example: d = {10, 4, 3, 3, 6, 9}; f = Interpolation[d]; FindMinimum[f[x], {x, 2, 1, Length[d]}] Question 2: You want to determine the minimum of ||X(zlast)-X(zfirst)|| over the initial conditions X,Y,X',Y' all at position: first. You have 4 parameters to vary, what is not a small task. Therefore, it helps if you can guess the location of the minimum and some intervalls around it to guide FindMinimum. First you would write a routine "getdiff" with a particular set of initial conditions as input and ||X(zlast)-X(zfirst)|| as output. Of course it will have to solve the ODE system and will threfore take its time. Because of this, it will help if you can guide FindMinimum so that fewer function evaluations are needed. This function getdiff you then plug into FindMinimum. Here is a simpe example: getdiff[x1_, x2_, x3_, x4_] := x1^2 + x2^2 + x3^2 + x4^2; FindMinimum[f[x1, x2, x3, x4], {x1, 1, -2, 2}, {x2, 1, -2, 2}, {x3, 1, -2, 2}, {x4, 1, -2, 2}] sincerely, Daniel jctobin at gmail.com wrote: > Hi all, > I am working in beam physics.I am getting used to mathematica > now.But feel little uncomfortable doing few things. > > Now I solved a differential (simulataneous ) equation in > {X''(z),Y''(z),X(z),Y(z)} with four intial conditons and getting the > answer for X & Y in interpolating function.I plot it for required z and > its all fine and great and FAST!! > > Question 1: > Now I want to find the minimum of this solution X(z).How do i use the > function FindMinimum for this interpolating function? > > Question 2: In the long run I want to find the value of the intial > conditions of the differential equation that will minimize > ||X(zlast)-X(zfirst)|| from the solution of the differential > equation?Any idea..Its a challenging problem. > > regards, > Beam Crazy >