<p>对于学校作业,我编写了一个算法,使用欧拉方法计算斜率。在其中的一部分,我有一个for循环,它将重复一个等式模式,直到最终结果得到满足。我需要的是一种方法,将每个结果添加到一个列表中,然后绘制列表中的每个项目。如果可能的话,我还需要一些帮助来设置for循环。你知道吗</p>
<p>以下是我所拥有的,请记住我在编码方面非常缺乏经验(请记住)</p>
<pre><code>stpsz = input ("Define "h" Value (step size)")
tfinal = input ("Define Final "T" Value (stopping place)")
xnow = input ("Define "X0" as a Starting Value")
t = 0
while t > tfinal
t = t + 1
slopenow = (xnow * (1-xnow))
#Save slopenow (as a number, not variable) to a list of slopes ( I don't understand how to make a list like this)
#Save xnow (as a number, not variable) to a list of xs)
xnext = (slopenow * stpsz)+(xnow)
xnext = x now
#repeat while-loop until tfinal is reached)
</code></pre>
<p>我非常感谢你们所能给予的一切帮助。你知道吗</p>