MathGroup Archive 2003

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

Search the Archive

Re: FindMinimum Problem


Hi,

what's bad on

foo[x_?NumericQ] := (x^2 - a[0]*x /.
NDSolve[{a'[z] == x*z, a[1] == 1}, a, {z, 0, 1}][[1]])


FindMinimum[foo[x], {x, -1, 1}]

clearly you have to decide what solution of NDSolve[] you whant to use.

The _?Numeric Pattern resturict the rule to numeric arguments of foo.



Regards

  Jens

"Jiang Xiao" <jiang.xiao at physics.gatech.edu> schrieb im Newsbeitrag
news:bpffpl$lv6$1 at smc.vnet.net...
> thank you for replying, I tried it, but it still doesn't work.
> what's the meaning of x_?NumericQ?
> if I let foo[x_?NumericQ]:=x^2-x, findminimum can't get output either,
> but no problem with foo[x_]:=x^2-x.
>
> Jiang
>
> Jens-Peer Kuska wrote:
> > Hi,
> >
> > you ust make a function
> >
> > foo[x_?NumericQ]:=x^2-a[0]*x/.NDSolve[{a'[z]==x*z,a[1]==1},a,{z,0,1}]
> >
> > FindMinimum[foo[x],{x,-1,1}]
> >
> > Regards
> >   Jens
> >
> > Jiang Xiao wrote:
> >
> >>Hi, all,
> >>    recently I am dealing with a problem as following, findminimum(over
x)
> >>of a function f[a[0],x], where a[z] satisfies a differential equation
> >>a'[z]=x*z say. The code is like:
>
>>FindMinimum[x^2-a[0]*x/.NDSolve[{a'[z]==x*z,a[1]==1},a,{z,0,1}],{x,-1,1}]
> >>
> >>the problem is that I can do it in mathematica 4.2, but can't in
mathematica
> >>5.0 now. Do anybody where is the problem?
> >>
> >>thanks,
> >>
> >>Jiang
> >
> >
>



  • Prev by Date: Re: Re: Improper integral
  • Next by Date: Re: Specify Step Size in NDSolve
  • Previous by thread: Re: FindMinimum Problem
  • Next by thread: Re: FindMinimum Problem