MathGroup Archive 1998

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

Search the Archive

Re: Duplicate Elements in List cause Errors with Interpolation


  • To: mathgroup@smc.vnet.net
  • Subject: [mg10680] Re: Duplicate Elements in List cause Errors with Interpolation
  • From: Allan Hayes <hay@haystack.demon.co.uk>
  • Date: Fri, 30 Jan 1998 04:24:18 -0500
  • References: <6ahp25$pkv@smc.vnet.net>

Todd Rose wrote:
> 
> This doesn't seem to work for me.  I can't figure out how to remove the
> duplicate in the first element of the data pairs (0.4375).  Union only
> seems to work if they are alike in both the abscissa and the ordinate.
> Perhaps I can use a test with the Union command, but I have not been
> able to figure out the format for the "spec".
> 
> mydata={{0,0},{0.109375,23.97675},{0.21875,40.76048},{0.328125,31.16978},{0.
> 4375,
>     26.37442},{0.4375,19.1814},{0.546875,59.94187},{0.65625,79.12328},{
>     0.71875,83.91862},{0.828125,91.11165},{0.9375,91.11165},{0.9921875,
>     93.50932},{1.101563,95.907},{1.210938,95.907},{1.273438,107.8954},{
>     1.382813,103.1},{1.492188,110.293},{1.539063,105.4977},{1.648438,
> 
> 107.8954},{1.757813,119.8837},{1.820313,112.6907},{1.921875,107.8954},{
>     2.03125,119.8837},{2.085938,119.8837},{2.203125,122.2814},{2.3125,
> 
> 124.6791},{2.359375,124.6791},{2.46875,124.6791},{2.578125,127.0768},{
>     2.640625,129.4744},{2.75,131.8721},{2.859375,131.8721},{2.90625,
> 
> 134.2698},{3.023438,136.6675},{3.132813,136.6675},{3.1875,134.2698},{
>     3.296875,136.6675},{3.40625,134.2698},{3.460938,143.8605},{3.570313,
> 
> 136.6675},{3.632813,139.0651},{3.679688,139.0651},{3.789063,143.8605},{
> 
> 3.898438,143.8605},{3.960938,148.6559},{4.070313,141.4628},{4.179688,
> 
> 148.6559},{4.289063,139.0651},{4.335938,143.8605},{4.453125,155.8489},{
>     4.5625,158.2466},{4.617188,155.8489},{4.726563,155.8489},{4.835938,
> 
> 163.0419},{4.890625,158.2466},{5,158.2466},{5.109375,163.0419},{5.171875,
>     167.8372},{5.28125,170.2349}}
>     ListPlot[mydata]
>     myfunction=Interpolation[mydata,InterpolationOrder->1]

Todd,

Union[mydata,SameTest-> (#1[[1]]==#2[[1]]&)]

{{0,0},{0.109375,23.97675},{0.21875,40.76048},{0.328125,31.16978},{0.4375,
    19.1814},{0.546875,59.94187},{0.65625,79.12328},{0.71875,83.91862},{
    0.828125,91.11165},{0.9375,91.11165},{0.9921875,93.50932},{1.101563,
   
95.907},{1.210938,95.907},{1.273438,107.8954},{1.382813,103.1},{1.492188,
   
110.293},{1.539063,105.4977},{1.648438,107.8954},{1.757813,119.8837},{
    1.820313,112.6907},{1.921875,107.8954},{2.03125,119.8837},{2.085938,
   
119.8837},{2.203125,122.2814},{2.3125,124.6791},{2.359375,124.6791},{
    2.46875,124.6791},{2.578125,127.0768},{2.640625,129.4744},{2.75,
   
131.8721},{2.859375,131.8721},{2.90625,134.2698},{3.023438,136.6675},{
    3.132813,136.6675},{3.1875,134.2698},{3.296875,136.6675},{3.40625,
   
134.2698},{3.460938,143.8605},{3.570313,136.6675},{3.632813,139.0651},{
   
3.679688,139.0651},{3.789063,143.8605},{3.898438,143.8605},{3.960938,
   
148.6559},{4.070313,141.4628},{4.179688,148.6559},{4.289063,139.0651},{
    4.335938,143.8605},{4.453125,155.8489},{4.5625,158.2466},{4.617188,
   
155.8489},{4.726563,155.8489},{4.835938,163.0419},{4.890625,158.2466},{5,
   
158.2466},{5.109375,163.0419},{5.171875,167.8372},{5.28125,170.2349}}



-- 
Allan Hayes
Mathematica Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642




  • Prev by Date: RE: Diamond Video card problems?
  • Next by Date: Importing and printing graphics files with Mathematica 3.0 ?
  • Prev by thread: Re: Duplicate Elements in List cause Errors with Interpolation
  • Next by thread: Announcement of PYML (Python/Mathematica Interface)