From: myadav@ruhets.rutgers.edu (Mahesh Yadav)
Newsgroups: sci.math.symbolic
Subject: extracting points from Plot[ ] (mma)?
Date: 7 Oct 92 04:44:58 GMT
Organization: Rutgers Univ., New Brunswick, N.J.


 Mathematica question on extracting the points which mma uses for Plotting
-------------------------------------------------------------------------------

	I am trying to extract the points { {x1,y1},{x2,y2},... } of some 
simple function, say y=Sin[x]. Now, if I like to extract about 10 points
which are EQUI-DISTANT in x, I can do it by the command:

In[1]:= Table[N[{x,Sin[x]}],{x,0,Pi,Pi/10}]

	But I am interested in the points which are "OPTIMIZED" like that in
the Plot command. In Plot command, the function is sampled according to the 
changes in the function -- sampling increases where the change in the function
is greater. 

	I can see the points by the command:

In[2]:=  InputForm[Plot[Sin[x],{x,0,Pi},DisplayFunction->1,PlotPoints->11]

		(Here DisplayFunction->1 to suppress the graphic output)

 but I get lot of extraneous information ( I have shown it in the end). Is 
there a way to just get the points in the format { {x1,y1},{x2,y2}, ... }.

 Also, Is there a way to make the first command I mentioned (In[1]:= ) in such
a way as to make similar optimization in x like that done in the Plot[ ] ?

	Thanks for your help 			Mahesh	Yadav
------------------------------------------------------------------------------
In[1]:= Table[N[{x,Sin[x]}],{x,0,Pi,Pi/10}]

Out[1]= {{0, 0}, {0.314159, 0.309017}, {0.628319, 0.587785},

>    {0.942478, 0.809017}, {1.25664, 0.951057}, {1.5708, 1.},

>    {1.88496, 0.951057}, {2.19911, 0.809017}, {2.51327, 0.587785},

>    {2.82743, 0.309017}, {3.14159, 0}}
-------------------------------------------------------------------------------
In[2]:=  InputForm[Plot[Sin[x],{x,0,Pi},DisplayFunction->1,PlotPoints->11]]
Out[35]//InputForm=
  1[Graphics[{{Line[{{0., 0.}, {0.3926990816987241, 0.3826834323650898},
        {0.5890486225480862, 0.5555702330196022},
        {0.7853981633974483, 0.7071067811865475},
        {0.98174770424681, 0.831469612302545},
        {1.079922474671491, 0.881921264348355},
        {1.178097245096172, 0.923879532511287},
        {1.276272015520854, 0.956940335732209},
        {1.325359400733194, 0.970031253194544},
        {1.374446785945534, 0.98078528040323},
        {1.423534171157875, 0.989176509964781},
        {1.448077863764045, 0.99247953459871},
        {1.472621556370215, 0.995184726672197},
        {1.497165248976386, 0.99729045667869},
        {1.521708941582556, 0.998795456205172},
        {1.546252634188726, 0.999698818696204}, {1.570796326794897, 1.},
        {1.595340019401067, 0.999698818696204},
        {1.619883712007237, 0.998795456205172},
        {1.644427404613407, 0.99729045667869},
        {1.668971097219578, 0.995184726672197},
        {1.718058482431918, 0.989176509964781},
        {1.767145867644259, 0.98078528040323},
        {1.86532063806894, 0.956940335732209},
        {1.963495408493621, 0.923879532511287},
        {2.159844949342982, 0.831469612302545},
        {2.356194490192345, 0.7071067811865476},
        {3.141592653589793, 1.224606353822377*10^-16}}]}},
    {PlotRange -> Automatic, AspectRatio -> GoldenRatio^(-1),
     DisplayFunction :> 1, ColorOutput -> Automatic, Axes -> Automatic,
     AxesOrigin -> Automatic, PlotLabel -> None, AxesLabel -> None,
     Ticks -> Automatic, GridLines -> None, Prolog -> {}, Epilog -> {},
     AxesStyle -> Automatic, Background -> Automatic,
     DefaultColor -> Automatic, DefaultFont :> $DefaultFont,
     RotateLabel -> True, Frame -> False, FrameStyle -> Automatic,
     FrameTicks -> Automatic, FrameLabel -> None, PlotRegion -> Automatic}]]
-------------------------------------------------------------------------------