在[-2, 4]区间每隔0.5取一个k值,求出每个k值对应的s。这样就得到坐标系中的点,用直线将点按照k值从小到大逐个连接起来,就得到根的轨迹了。如果嫌0.5间距太大,轨迹不够圆滑,可以将间距取的小一点。直线可以用line命令画出。点可以理解成半径很小的实心圆,用circle画出。
贴一个c语言画圆和画直线的示例:
1./*学用circle画圆形*/
#include "graphics.h"
main()
{int driver,mode,i
float j=1,k=1
driver=VGAmode=VGAHI
initgraph(&driver,&mode,"")
setbkcolor(YELLOW)
for(i=0i<=25i++)
{
setcolor(8)
circle(310,250,k)
k=k+j
j=j+0.3
}
getch()
}
2.//line画直线
#include "graphics.h"
main()
{int driver,mode,i
float x0,y0,y1,x1
float j=12,k
driver=VGAmode=VGAHI
initgraph(&driver,&mode,"")
setbkcolor(GREEN)
x0=263y0=263y1=275x1=275
for(i=0i<=18i++)
{
setcolor(5)
line(x0,y0,x0,y1)
x0=x0-5
y0=y0-5
x1=x1+5
y1=y1+5
j=j+10
}
x0=263y1=275y0=263
for(i=0i<=20i++)
{
setcolor(5)
line(x0,y0,x0,y1)
x0=x0+5
y0=y0+5
y1=y1-5
}
getch()
}
<script>(function(){
$('input[type="button"]').on('click', function(){
var $this = $(this),
$td_arr = $this.parent().html('complete').prevAll('td')
$.each($td_arr, function(){
var $td = $(this)
$td.html('<input type="text" value="'+$td.html()+'">')
})
})
})()
</script>