Python论坛  - 讨论区

标题:[python-chinese] 算法问题求教

2006年04月25日 星期二 16:00

Gerald Lee leejd80 at gmail.com
Tue Apr 25 16:00:27 HKT 2006

我有N个点,坐标数据为:
Parts = {
  "Part1":{"X":12.0, "Y":3.0}
  "Part2":{"X":1.0, "Y":24.0}
  "Part3":{"X":22.0, "Y":7.0}
  "Part4":{"X":5.0, "Y":30.0}
  "Part5":{"X":120.0, "Y":50.0}
}

我想求得一个点,使得这个点到各个点的总距离最短,这种算法是什么算法?

--
My Blog >> http://leejd.cndev.org
My QQ >> 9847243
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060425/5a8e8407/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年04月25日 星期二 16:36

helium helium.sun at gmail.com
Tue Apr 25 16:36:19 HKT 2006

没啥算法吧,挨个算呗

在06-4-25,Gerald Lee <leejd80 at gmail.com> 写道:
>
> 我有N个点,坐标数据为:
> Parts = {
>   "Part1":{"X":12.0, "Y":3.0}
>   "Part2":{"X":1.0, "Y":24.0}
>   "Part3":{"X":22.0, "Y":7.0}
>   "Part4":{"X": 5.0, "Y":30.0}
>   "Part5":{"X":120.0, "Y":50.0}
> }
>
> 我想求得一个点,使得这个点到各个点的总距离最短,这种算法是什么算法?
>
>
> --
> My Blog >> http://leejd.cndev.org
> My QQ >> 9847243
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060425/9f48e0b7/attachment-0001.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年04月25日 星期二 16:48

xianglong yin yinxianglong at gmail.com
Tue Apr 25 16:48:35 HKT 2006

动态规划算法

在06-4-25,helium <helium.sun at gmail.com> 写道:
>
> 没啥算法吧,挨个算呗
>
> 在06-4-25,Gerald Lee <leejd80 at gmail.com> 写道:
> >
> >  我有N个点,坐标数据为:
> Parts = {
>   "Part1":{"X":12.0, "Y":3.0}
>   "Part2":{"X":1.0, "Y":24.0}
>   "Part3":{"X":22.0 , "Y":7.0}
>   "Part4":{"X": 5.0, "Y":30.0}
>   "Part5":{"X":120.0, "Y":50.0}
> }
>
> 我想求得一个点,使得这个点到各个点的总距离最短,这种算法是什么算法?
>
>
> --
> My Blog >> http://leejd.cndev.org
> My QQ >> 9847243
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to   python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060425/72af3e38/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年04月25日 星期二 17:07

Leo Jay python.leojay at gmail.com
Tue Apr 25 17:07:31 HKT 2006

On 4/25/06, Gerald Lee <leejd80 at gmail.com> wrote:
>
> 我有N个点,坐标数据为:
> Parts = {
>   "Part1":{"X":12.0, "Y":3.0}
>   "Part2":{"X":1.0, "Y":24.0}
>   "Part3":{"X":22.0, "Y":7.0}
>   "Part4":{"X": 5.0, "Y":30.0}
>   "Part5":{"X":120.0, "Y":50.0}
> }
>
> 我想求得一个点,使得这个点到各个点的总距离最短,这种算法是什么算法?
>
>
>
> 你所要求的点要不要求在所给的点里?
如果是在平面上求一点,这一点到所有点的总距离最短,那所求点就应该是(sum(Xi)/n,sum(Yi)/n),也就是质点组的重心点.

--
Best Regards,
Leo Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060425/4d4c9222/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年04月25日 星期二 18:22

helium helium.sun at gmail.com
Tue Apr 25 18:22:47 HKT 2006

这题能用dp?怎么搞?

在06-4-25,xianglong yin <yinxianglong at gmail.com> 写道:
>
> 动态规划算法
>
> 在06-4-25,helium <helium.sun at gmail.com> 写道:
>
> > 没啥算法吧,挨个算呗
> >
> > 在06-4-25,Gerald Lee <leejd80 at gmail.com> 写道:
> > >
> > >  我有N个点,坐标数据为:
> > Parts = {
> >   "Part1":{"X":12.0, "Y":3.0}
> >   "Part2":{"X":1.0, "Y":24.0}
> >   "Part3":{"X":22.0 , "Y":7.0}
> >   "Part4":{"X": 5.0, "Y":30.0}
> >   "Part5":{"X":120.0, "Y":50.0}
> > }
> >
> > 我想求得一个点,使得这个点到各个点的总距离最短,这种算法是什么算法?
> >
> >
> > --
> > My Blog >> http://leejd.cndev.org
> > My QQ >> 9847243
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
> >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060425/2a64fc79/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年04月25日 星期二 18:57

wangmm kernellearn at gmail.com
Tue Apr 25 18:57:54 HKT 2006

归纳一下:
就是在二维平面上寻找距离最近的点。

可以试一试遗传算法,不过得到的可能不是最优的。
不知道这个问题有没有最优解?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060425/b03c4f3e/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年04月25日 星期二 21:21

Gu Yingbo tensiongyb at gmail.com
Tue Apr 25 21:21:16 HKT 2006

我也觉得不能,只有数学方法才是正道吧。因为结果可能不唯一,比如两点之间的任意一点都是最小值。

On 4/25/06, helium <helium.sun at gmail.com> wrote:
>
> 这题能用dp?怎么搞?
>
> 在06-4-25,xianglong yin <yinxianglong at gmail.com> 写道:
>
> > 动态规划算法
> >
> > 在06-4-25,helium <helium.sun at gmail.com> 写道:
> >
> > > 没啥算法吧,挨个算呗
> > >
> > > 在06-4-25,Gerald Lee <leejd80 at gmail.com> 写道:
> > > >
> > > >  我有N个点,坐标数据为:
> > > Parts = {
> > >   "Part1":{"X":12.0, "Y":3.0}
> > >   "Part2":{"X":1.0, "Y":24.0}
> > >   "Part3":{"X":22.0 , "Y":7.0}
> > >   "Part4":{"X": 5.0, "Y":30.0}
> > >   "Part5":{"X":120.0, "Y":50.0}
> > > }
> > >
> > > 我想求得一个点,使得这个点到各个点的总距离最短,这种算法是什么算法?
> > >
> > >
> > > --
> > > My Blog >> http://leejd.cndev.org
> > > My QQ >> 9847243
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request at lists.python.cn
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request at lists.python.cn
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > >
> > >
> >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060425/98c96c97/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年04月26日 星期三 11:41

sun baole sun_able at kinca.cn
Wed Apr 26 11:41:47 HKT 2006

An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060426/68f51faf/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年04月26日 星期三 11:57

hyp yipenghuang at gmail.com
Wed Apr 26 11:57:26 HKT 2006

这是一个统计学的简单问题,用最小二乘法算。

好像是处理多个测量实验数据用的。

 

  _____  

发件人: python-chinese-bounces at lists.python.cn
[mailto:python-chinese-bounces at lists.python.cn] 代表 sun baole
发送时间: 2006年4月26日 11:42
收件人: python-chinese at lists.python.cn
主题: Re: [python-chinese] 算法问题求教

 

Gu Yingbo 写道: 

我也觉得不能,只有数学方法才是正道吧。因为结果可能不唯一,比如两点之间的任意
一点都是最小值。

On 4/25/06, helium <helium.sun at gmail.com> wrote: 

这题能用dp?怎么搞?

在06-4-25,xianglong yin <yinxianglong at gmail.com > 写道: 

动态规划算法

在06-4-25,helium <helium.sun at gmail.com> 写道: 

没啥算法吧,挨个算呗

在06-4-25,Gerald Lee <leejd80 at gmail.com> 写道: 

我有N个点,坐标数据为:
Parts = {
  "Part1":{"X":12.0, "Y":3.0}
  "Part2":{"X":1.0, "Y":24.0}
  "Part3":{"X":22.0 , "Y":7.0}
  "Part4":{"X": 5.0, "Y":30.0}
  "Part5":{"X":120.0, "Y":50.0}
}

我想求得一个点,使得这个点到各个点的总距离最短,这种算法是什么算法?
 


-- 
My Blog >> http://leejd.cndev.org <http://leejd.cndev.org/>  
My QQ >> 9847243 

 

_______________________________________________
python-chinese
Post: send python-chinese at lists.python.cn 
Subscribe: send subscribe to python-chinese-request at lists.python.cn 
Unsubscribe: send unsubscribe to   python-chinese-request at lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese


 


_______________________________________________
python-chinese
Post: send python-chinese at lists.python.cn
Subscribe: send subscribe to python-chinese-request at lists.python.cn 
Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese


 


_______________________________________________
python-chinese
Post: send python-chinese at lists.python.cn
Subscribe: send subscribe to python-chinese-request at lists.python.cn 
Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese

 


_______________________________________________
python-chinese
Post: send python-chinese at lists.python.cn 
Subscribe: send subscribe to python-chinese-request at lists.python.cn
Unsubscribe: send unsubscribe to   python-chinese-request at lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese





 





  _____  



 
_______________________________________________
python-chinese
Post: send python-chinese at lists.python.cn
Subscribe: send subscribe to python-chinese-request at lists.python.cn
Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
Detail Info: http://python.cn/mailman/listinfo/python-chinese

还是得借助数学的方法,先根据给定点,找到离给定点距离都相同的点的座标。然后拿
这个点与新给定点进行比较。

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060426/b8ced1e7/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年04月26日 星期三 13:26

Gu Yingbo tensiongyb at gmail.com
Wed Apr 26 13:26:30 HKT 2006

其实就是多元函数极值的问题:
D = \sum_{i = 1}^N \sqrt{(x-x_i)^2 + (y - y_i)^2}
求 D 的最小值,解 dD/dx = 0 且 dD/dy = 0 得出驻点的坐标值,再从一系列驻点中找出极值点。
麻烦的是求解微分,忘光光了。
其实这个问题还是挺麻烦的,绝不是求算术平均值得到的解。
另外,最小二乘法得到的结果好像是近似值,不是精确解。
这个问题虽然得到的可能是一个或一系列解,但一定有精确解存在。

On 4/26/06, sun baole <sun_able at kinca.cn> wrote:
>
> Gu Yingbo 写道:
>
> 我也觉得不能,只有数学方法才是正道吧。因为结果可能不唯一,比如两点之间的任意一点都是最小值。
>
> On 4/25/06, helium <helium.sun at gmail.com> wrote:
> >
> > 这题能用dp?怎么搞?
> >
> > 在06-4-25,xianglong yin <yinxianglong at gmail.com > 写道:
> >
> > > 动态规划算法
> > >
> > > 在06-4-25,helium <helium.sun at gmail.com> 写道:
> > >
> > > > 没啥算法吧,挨个算呗
> > > >
> > > > 在06-4-25,Gerald Lee <leejd80 at gmail.com> 写道:
> > > >  我有N个点,坐标数据为:
> > > > Parts = {
> > > >   "Part1":{"X":12.0, "Y":3.0}
> > > >   "Part2":{"X":1.0, "Y":24.0}
> > > >   "Part3":{"X":22.0 , "Y":7.0}
> > > >   "Part4":{"X": 5.0, "Y":30.0}
> > > >   "Part5":{"X":120.0, "Y":50.0}
> > > > }
> > > >
> > > > 我想求得一个点,使得这个点到各个点的总距离最短,这种算法是什么算法?
> > > >
> > > >
> > > > --
> > > > My Blog >> http://leejd.cndev.org
> > > > My QQ >> 9847243
> > > >
> > > >  _______________________________________________
> > > > python-chinese
> > > > Post: send python-chinese at lists.python.cn
> > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > > Unsubscribe: send unsubscribe to
> > > > python-chinese-request at lists.python.cn
> > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > python-chinese
> > > > Post: send python-chinese at lists.python.cn
> > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > > Unsubscribe: send unsubscribe to
> > > > python-chinese-request at lists.python.cn
> > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > > >
> > > >
> > >
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request at lists.python.cn
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > >
> > >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
> ------------------------------
>
> _______________________________________________ python-chinese Post: send
> python-chinese at lists.python.cn Subscribe: send subscribe to
> python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
> 还是得借助数学的方法,先根据给定点,找到离给定点距离都相同的点的座标。然后拿这个点与新给定点进行比较。
>

这个方法不行吧,太复杂了,每次都要考虑与前面点位置的变化。

_______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060426/76c51c10/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年04月26日 星期三 14:04

Shixin Zeng zeng.shixin at gmail.com
Wed Apr 26 14:04:02 HKT 2006

On 4/26/06, Gu Yingbo <tensiongyb at gmail.com> wrote:
>
> 其实就是多元函数极值的问题:
> D = \sum_{i = 1}^N \sqrt{(x-x_i)^2 + (y - y_i)^2}
> 求 D 的最小值,解 dD/dx = 0 且 dD/dy = 0 得出驻点的坐标值,再从一系列驻点中找出极值点。
> 麻烦的是求解微分,忘光光了。
>

麻烦的不是求解微分,而是最后的方程组:
\sum_{i=1}^N \frac{x_i-x}{\sqrt{(x-x_i)^2 + (y - y_i)^2}} = 0 &&
\sum_{i=1}^N \frac{y_i-y}{\sqrt{(x-x_i)^2 + (y - y_i)^2}} = 0
这是一个二元n次方程组,而这,在数学上还没有通用的解法,除了迭代,我想不出好的办法。

其实这个问题还是挺麻烦的,绝不是求算术平均值得到的解。
>
另外,最小二乘法得到的结果好像是近似值,不是精确解。
> 这个问题虽然得到的可能是一个或一系列解,但一定有精确解存在。
>
> On 4/26/06, sun baole <sun_able at kinca.cn> wrote:
> >
> >  Gu Yingbo 写道:
> >
> > 我也觉得不能,只有数学方法才是正道吧。因为结果可能不唯一,比如两点之间的任意一点都是最小值。
> >
> > On 4/25/06, helium <helium.sun at gmail.com > wrote:
> > >
> > > 这题能用dp?怎么搞?
> > >
> > > 在06-4-25,xianglong yin <yinxianglong at gmail.com > 写道:
> > >
> > > > 动态规划算法
> > > >
> > > > 在06-4-25,helium <helium.sun at gmail.com > 写道:
> > > >
> > > > > 没啥算法吧,挨个算呗
> > > > >
> > > > > 在06-4-25,Gerald Lee <leejd80 at gmail.com > 写道:
> > > > >  我有N个点,坐标数据为:
> > > > > Parts = {
> > > > >   "Part1":{"X":12.0, "Y":3.0}
> > > > >   "Part2":{"X":1.0, "Y":24.0}
> > > > >   "Part3":{"X":22.0 , "Y":7.0}
> > > > >   "Part4":{"X": 5.0, "Y":30.0}
> > > > >   "Part5":{"X":120.0, "Y":50.0}
> > > > > }
> > > > >
> > > > > 我想求得一个点,使得这个点到各个点的总距离最短,这种算法是什么算法?
> > > > >
> > > > >
> > > > > --
> > > > > My Blog >> http://leejd.cndev.org
> > > > > My QQ >> 9847243
> > > > >
> > > > >  _______________________________________________
> > > > > python-chinese
> > > > > Post: send python-chinese at lists.python.cn
> > > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > > >
> > > > > Unsubscribe: send unsubscribe to
> > > > > python-chinese-request at lists.python.cn
> > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > python-chinese
> > > > > Post: send python-chinese at lists.python.cn
> > > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > > >
> > > > > Unsubscribe: send unsubscribe to
> > > > > python-chinese-request at lists.python.cn
> > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > > > >
> > > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > python-chinese
> > > > Post: send python-chinese at lists.python.cn
> > > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > > Unsubscribe: send unsubscribe to
> > > > python-chinese-request at lists.python.cn
> > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > > >
> > > >
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request at lists.python.cn
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> > >
> > >
> > ------------------------------
> >
> > _______________________________________________ python-chinese Post:
> > send python-chinese at lists.python.cn Subscribe: send subscribe to
> > python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn Detail Info:
> > http://python.cn/mailman/listinfo/python-chinese
> > 还是得借助数学的方法,先根据给定点,找到离给定点距离都相同的点的座标。然后拿这个点与新给定点进行比较。
> >
>
> 这个方法不行吧,太复杂了,每次都要考虑与前面点位置的变化。
>
> _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>


--
Best Regards

Shixin Zeng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060426/5b8506aa/attachment-0001.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年04月28日 星期五 16:12

yzhh yezonghui at gmail.com
Fri Apr 28 16:12:21 HKT 2006

如果是要求Sum( sqrt( (Xi-X)**2 + (Yi-Y)**2 ) )最小,可以考虑用牛顿迭代法
如果是要求Sum( (Xi-X)**2 + (Yi-Y)**2 )最小,那么X和Y可以分别求,答案就是Leo Jay那个
从目标函数的形式看,这两个问题答案应该是不一样的

Leo Jay wrote:
如果是在平面上求一点,这一点到所有点的总距离最短,那所求点就应该是(sum(Xi)/n,sum(Yi)/n),也就是质点组的重心点.
-- 
   regards,
yzhh


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号