       Re: FindInstance question

• To: mathgroup at smc.vnet.net
• Subject: [mg55770] Re: [mg55736] FindInstance question
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Wed, 6 Apr 2005 03:10:59 -0400 (EDT)
• Reply-to: hanlonr at cox.net
• Sender: owner-wri-mathgroup at wolfram.com

Needs["Graphics`"];

FilledPlot[{x,x^2},{x,-1,2}];

FilledPlot[{0,Boole[x<x^2]}, {x, -1, 2}];

ListPlot[x/.FindInstance[{x<x^2,x>-1,x<2}, x,Reals,100]];

Bob Hanlon

>
> From: János <janos.lobb at yale.edu>
To: mathgroup at smc.vnet.net
> Date: 2005/04/05 Tue AM 03:20:55 EDT
> To: mathgroup at smc.vnet.net
> Subject: [mg55770] [mg55736] FindInstance question
>
> If I am looking for the solution set of x < x^2, Reduce gives me the
>
> In:=
> Reduce[x < x^2, x]
> Out=
> x < 0 || x > 1
>
> I tried to use FindInstance and ListPlot to visualize it for my 7th
> grade son, based upon the example on the Book Section 3.4.8.
>
> In:=
> FindInstance[x < x^2, x,
>    Reals, 50]
> Out=
> {{x -> -4375}, {x -> -4304},
>    {x -> -4089}, {x -> -3945},
>    {x -> -3707}, {x -> -3682},
>    {x -> -3486}, {x -> -3414},
>    {x -> -3331}, {x -> -3286},
>    {x -> -3248}, {x -> -3018},
>    {x -> -2974}, {x -> -2953},
>    {x -> -2941}, {x -> -2877},
>    {x -> -2864}, {x -> -2687},
>    {x -> -2525}, {x -> -2373},
>    {x -> -2108}, {x -> -2074},
>    {x -> -1773}, {x -> -1403},
>    {x -> -1402}, {x -> -1348},
>    {x -> -1092}, {x -> -566},
>    {x -> -51}, {x -> 77},
>    {x -> 195}, {x -> 1181},
>    {x -> 1216}, {x -> 1547},
>    {x -> 1687}, {x -> 1765},
>    {x -> 1876}, {x -> 2040},
>    {x -> 2713}, {x -> 2734},
>    {x -> 3018}, {x -> 3312},
>    {x -> 3455}, {x -> 3503},
>    {x -> 3704}, {x -> 3927},
>    {x -> 3974}, {x -> 3985},
>    {x -> 4349}, {x -> 4944}}
>
> Well, the closest values to 0 and 1 are -51 and 77.  It is not
> terrible useful to ListPlot them.  If I select 500 points instead of
> 50 it just gets worse.
>
> My question is:
>
> 1,  Is it possible to suggest FindInstance to use values "much
> closer" to the boundaries of 0 and 1 or
>
> 2 If it is not possible, what methods others would use for this
> situation to visualize ?
>
> I tried
>
> In:=
> FindInstance[x < x^2 &&
>     x > -2 && x < 2, x, Reals,
>    50]
>
> but that is not the original inequality :)
> I also tried to replace the Reals domain with something - logical
> looking - else, but Mathematica really wants a built in domain there.
>
> In:=
> FindInstance[x < x^2, x,
>    x > -2 && x < 2, 50]
>
> or
>
> In:=
> FindInstance[x < x^2, x,
>    {-2, 2}, 50]
>
> and it complained:
>
> FindInstance::"bddom":"Value \!\(\(\(x > \(\(-2\)\)\)\) && \(\(x < 2\)
> \)\) of \
> the domain argument should be Complexes, Reals, Algebraics, Rationals, \
> Integers, Primes, Booleans, or Automatic. \
> \", \
> ButtonFrame->None, ButtonData:>\"FindInstance::bddom\"]\)"
>
>
> A  non existent "user defined Domain" would be handy here.  I am
> thinking of a
>
> myDomain[x_Real]:=UserDefinedDomain[x > -2 && x < 3]
>
> or similar construction to put into FindInstance.  Is that too much
> to ask ?
>