<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>男单 618 &#187; 动画</title>
	<atom:link href="http://www.ai7.org/wp/html/tag/%e5%8a%a8%e7%94%bb/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ai7.org/wp</link>
	<description>生活象筒装的卫生纸，开始的时候怎么扯都不觉得在转，后来转的越来越快。</description>
	<lastBuildDate>Sun, 11 Dec 2011 12:22:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Sage绘制摆线动画</title>
		<link>http://www.ai7.org/wp/html/695.html</link>
		<comments>http://www.ai7.org/wp/html/695.html#comments</comments>
		<pubDate>Thu, 21 Jan 2010 14:23:22 +0000</pubDate>
		<dc:creator>amao</dc:creator>
				<category><![CDATA[sage]]></category>
		<category><![CDATA[动画]]></category>

		<guid isPermaLink="false">http://www.ai7.org/wp/?p=695</guid>
		<description><![CDATA[在Sage中绘制动画，实际上是先画出每一帧，再使用imagemagick将多幅图像转化为gif动画。先来看一个简单例子： t,u=var(&#8216;t,u&#8217;) cc=[point((cos(t),sin(t)),pointsize=30,rgbcolor='red')+parametric_plot((cos(u),sin(u)),(0,t)) for t in srange(0.01,2*pi,0.2)] myan=animate(cc,xmin=-1.5, xmax=1.5,ymin=-1.5, ymax=1.5,aspect_ratio=1) show(myan) 第2行中每帧图像由两部分组成，一是动点，二是圆弧。这里，srange函数中的初值不能取零，否则会出错。第3行中将绘图的坐标范围固定，如果不固定，Sage会将当前图像主体放置在图像中央，自动调整坐标轴的显示范围。这一特性在绘制静态图像时，非常有用，但这样得到的动画往往不是我们想要的。 下面来看圆摆线x=a*(u-sin(u)), y=a*(1-cos(u)),  0&#60;u&#60;2*pi的绘制： u=var(&#8216;u&#8217;) a=2 pic=[parametric_plot((a*(u-sin(u)),a*(1-cos(u))),(u,0,t),rgbcolor='red')\ +circle((a*t,a),a,rgbcolor='blue')\ +point((a*(t-sin(t)),a*(1-cos(t))),pointsize=20,rgbcolor='red')\ +line([(a*t,a),(a*(t-sin(t)),a*(1-cos(t)))],rgbcolor=&#8217;blue&#8217;) for t in srange(0.01,2*pi+0.1,0.2)] bbb=animate(pic,xmin=-0.5,xmax=(2*pi+1)*a,ymin=-1, ymax=2*a+1,aspect_ratio=1) show(bbb) 注：其他一些数学软件绘图时，如果不手工清除绘图区域，则上一个图像会保留下来，这与Sage的工作方式不同。Sage中的每一帧都是“全新”绘制的。 下面将其转化为交互式的图形： @interact def _(t=(0.01,2*pi,0.5)): u=var(&#8216;u&#8217;) a=2 pic=parametric_plot((a*(u-sin(u)),a*(1-cos(u))),(u,0,t),rgbcolor=&#8217;red&#8217;)\ +circle((a*t,a),a,rgbcolor=&#8217;blue&#8217;)\ +point((a*(t-sin(t)),a*(1-cos(t))),pointsize=20,rgbcolor=&#8217;red&#8217;)\ +line([(a*t,a),(a*(t-sin(t)),a*(1-cos(t)))],rgbcolor=&#8217;blue&#8217;) show(pic,xmin=-0.5,xmax=(2*pi+1)*a,ymin=-1, ymax=2*a+1,aspect_ratio=1) 由于刷新的问题，更新不连贯，拖放之后，需要等一下。<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">相关文章：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F688.html&from=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F695.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用Sage绘制动画的一个例子</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F658.html&from=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F695.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">翻译Sage文档的准备工作</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F668.html&from=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F695.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Sage 4.3今日发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F682.html&from=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F695.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Sage Tutorial中文版</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>在Sage中绘制动画，实际上是先画出每一帧，再使用imagemagick将多幅图像转化为gif动画。先来看一个简单例子：</p>
<p>t,u=var(&#8216;t,u&#8217;)<br />
cc=[point((cos(t),sin(t)),pointsize=30,rgbcolor='red')+parametric_plot((cos(u),sin(u)),(0,t)) for t in srange(0.01,2*pi,0.2)]<br />
myan=animate(cc,xmin=-1.5, xmax=1.5,ymin=-1.5, ymax=1.5,aspect_ratio=1)<br />
show(myan)</p>
<p><a href="http://www.ai7.org/wp/wp-content/uploads/2010/01/yuan.gif"><img class="aligncenter size-full wp-image-696" title="yuan" src="http://www.ai7.org/wp/wp-content/uploads/2010/01/yuan.gif" alt="" width="484" height="484" /></a>第2行中每帧图像由两部分组成，一是动点，二是圆弧。这里，srange函数中的初值不能取零，否则会出错。第3行中将绘图的坐标范围固定，如果不固定，Sage会将当前图像主体放置在图像中央，自动调整坐标轴的显示范围。这一特性在绘制静态图像时，非常有用，但这样得到的动画往往不是我们想要的。</p>
<p>下面来看圆摆线x=a*(u-sin(u)), y=a*(1-cos(u)),  0&lt;u&lt;2*pi的绘制：</p>
<p>u=var(&#8216;u&#8217;)<br />
a=2<br />
pic=[parametric_plot((a*(u-sin(u)),a*(1-cos(u))),(u,0,t),rgbcolor='red')\<br />
+circle((a*t,a),a,rgbcolor='blue')\<br />
+point((a*(t-sin(t)),a*(1-cos(t))),pointsize=20,rgbcolor='red')\<br />
+line([(a*t,a),(a*(t-sin(t)),a*(1-cos(t)))],rgbcolor=&#8217;blue&#8217;) for t in srange(0.01,2*pi+0.1,0.2)]<br />
bbb=animate(pic,xmin=-0.5,xmax=(2*pi+1)*a,ymin=-1, ymax=2*a+1,aspect_ratio=1)<br />
show(bbb)</p>
<p><a href="http://www.ai7.org/wp/wp-content/uploads/2010/01/baixian.gif"><img class="aligncenter size-full wp-image-698" title="baixian" src="http://www.ai7.org/wp/wp-content/uploads/2010/01/baixian.gif" alt="" width="484" height="208" /></a></p>
<p>注：其他一些数学软件绘图时，如果不手工清除绘图区域，则上一个图像会保留下来，这与Sage的工作方式不同。Sage中的每一帧都是“全新”绘制的。</p>
<p>下面将其转化为交互式的图形：</p>
<p>@interact<br />
def _(t=(0.01,2*pi,0.5)):<br />
u=var(&#8216;u&#8217;)<br />
a=2<br />
pic=parametric_plot((a*(u-sin(u)),a*(1-cos(u))),(u,0,t),rgbcolor=&#8217;red&#8217;)\<br />
+circle((a*t,a),a,rgbcolor=&#8217;blue&#8217;)\<br />
+point((a*(t-sin(t)),a*(1-cos(t))),pointsize=20,rgbcolor=&#8217;red&#8217;)\<br />
+line([(a*t,a),(a*(t-sin(t)),a*(1-cos(t)))],rgbcolor=&#8217;blue&#8217;)<br />
show(pic,xmin=-0.5,xmax=(2*pi+1)*a,ymin=-1, ymax=2*a+1,aspect_ratio=1)</p>
<p><a href="http://www.ai7.org/wp/wp-content/uploads/2010/01/jiaohu.png"><img class="aligncenter size-full wp-image-702" title="jiaohu" src="http://www.ai7.org/wp/wp-content/uploads/2010/01/jiaohu.png" alt="" width="595" height="298" /></a></p>
<p>由于刷新的问题，更新不连贯，拖放之后，需要等一下。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">相关文章：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F688.html&from=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F695.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用Sage绘制动画的一个例子</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F658.html&from=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F695.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">翻译Sage文档的准备工作</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F668.html&from=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F695.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Sage 4.3今日发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F682.html&from=http%3A%2F%2Fwww.ai7.org%2Fwp%2Fhtml%2F695.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Sage Tutorial中文版</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.ai7.org/wp/html/695.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

