[Date Index]
[Thread Index]
[Author Index]
Re: NMinimize a function of NMaximize
*To*: mathgroup at smc.vnet.net
*Subject*: [mg80004] Re: NMinimize a function of NMaximize
*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
*Date*: Fri, 10 Aug 2007 01:55:55 -0400 (EDT)
*Organization*: Uni Leipzig
*References*: <f9endl$meh$1@smc.vnet.net>
*Reply-to*: kuska at informatik.uni-leipzig.de
Hi,
you should have a look at the results that NMaximize[] return
(a list {function value, maximum position} and not a single value
that is expected by NMinimize[] ..
g[x_] := 1 (Pi - 2 x*Sqrt[1 - x^2] - 2 ArcSin[x])
d[x_, o_?NumericQ, n_Integer] :=
Abs[g[x] - Normal[Series[g[y], {y, o, n}]]] /. y -> x
f[p_?NumericQ] := NMaximize[{d[x, p, 3], 0 <= x <= 1}, x][[1]]
NMinimize[{f[p], 0 <= p <= 1}, p]
may work. Even when it take a bit longer.
Regards
Jens
sapsi wrote:
> I have a function
> g[x_]:=1 (Pi - 2 x*Sqrt[1 - x^2] - 2 ArcSin[x])
> d[x_, o_, n_] := Abs[g[x] - Normal[Series[g[y], {y, o, n}]]] /. y -> x
>
> d[] is the absolute difference of g[] and its Taylor series
> approximation
>
> dm[p_] := NMaximize[{d[x, p, 3], 0 <= x <= 1}, x][[1]]
>
> dm[] is the maximum absolute difference between the Taylor series
> approximation(3rd order) around p and g[].
> I wish to find that value of 'p' that minimizes this maximum
> difference - i tried plotting and can see where the minima occurs but
> would like the exact value. So, it thought this would work
>
> NMinimize[{NMaximize[{ d[x, p, 3], 0 <= x <= 1}, x], 0 <= p <= 1}, p].
> Instead i get errors (briefly)
>
> NMaximize::nnum: The function value -Abs[-2.41057-(2 (<<19>>-p)^2 \
> p)/Sqrt[1-p^2]+2 p Sqrt[1-p^2]+(2 (<<1>>)^3)/(3 Sqrt[1-<<1>>] \
> (-1+p^2))-(4 (0.652468-p) (-1+p^2))/Sqrt[1-p^2]+2 ArcSin[p]] is not a
> \
> number at {x} = {0.652468}. >>
> NMaximize::nnum: "The function value \
> -Abs[-2.41057-(2\(<<19>>-p)^2\p)/Sqrt[1-p^2]+2\ p\ Sqrt[1-p^2]+(2\(<<\
> 1>>)^3)/(3\Sqrt[1-<<1>>]\(-1+p^2))-(4\(0.652468-p)\(-1+p^2))/Sqrt[1-p^
> \
> 2]+2\ ArcSin[p]] is not a number at {x} = {0.6524678079740285`}."
> NMaximize::nnum: The function value -Abs[-2.41057-(2 (<<19>>-p)^2 \
> p)/Sqrt[1-p^2]+2 p Sqrt[1-p^2]+(2 (<<1>>)^3)/(3 Sqrt[1-<<1>>] \
> (-1+p^2))-(4 (0.652468-p) (-1+p^2))/Sqrt[1-p^2]+2 ArcSin[p]] is not a
> \
> number at {x} = {0.652468}. >>
> NMinimize::nnum:
>
> Can anyone provide any pointers on how to find the minimum of dm[]?
> Thank you for your time
> Saptarshi
>
>
Prev by Date:
**Why no option SaveDefinitions in DynamicModule?**
Next by Date:
**Re: FindRoot can NOT handle mixed real and complex variables**
Previous by thread:
**Re: NMinimize a function of NMaximize**
Next by thread:
**Integration of Singular function**
| |