2013-03-20 9 views
6

adımı seçeneği etkinleştirerek sorunu Python - Scipy: kaside modülü: Bu yüzden bir süre döngü mi <pre><code>solver1.integrate(t_end) </code></pre> <p></p> ve: çözücü Ben bunu çağırdığınızda çözücü kendisi tarafından alınan farklı entegrasyon adımları saklamak istedim

while solver1.successful() and solver1.t < t0+dt: 
    solver1.integrate(t_end,step=True) 
    time.append(solver1.t) 

Sonra y, entegrasyon sonucu çizmek ve burada sorunumu gelir: True için değerini ayarlama adımı seçeneği sağladı. Bunun nedeni böyle döngü ya da bir şey olduğunu düşündüm

y enabling the step option of the solver

yüzden step kaldırma sonucu kontrol:

while solver1.successful() and solver1.t < t0+dt: 
    solver1.integrate(t_end) 

Ve sürpriz bir yer alanda görünen kararsızlıkları var.

y disabling the step option of the solver

bir çıkmak oluyor: .. ben doğru sonucu var garip bir durum ... Eğer birileri bana bu konuda yardım ederse minnettar olurum.

DÜZENLEME:

yapmam çözücüsü ayarlamak için:

solver1 = ode(y_dot,jac).set_integrator('vode',with_jacobian=True) 
solver1.set_initial_value(x0,t0) 

Ve seni step=True dolaylı vode._integrator.runner (Fortran altyordamını) veriyoruz ayarlandığında .append()

+0

Can Bu runner suçum hakkında daha fazla bilgi alabilirsiniz Biraz daha kodunuzu gösterir, çözücüyü nasıl kurarsınız ve sonucu çizim için saklarsınız? – silvado

+0

Elbette, sorumu yeni düzenledim. – kuider

+0

Çizimleri, ODE durum değişkenlerinden birini gösterdiğini farz edersiniz, çizdiğiniz mevcut ODE durumunu gerçekten nasıl depoladığınızı hala göstermediniz. – Nikolas

cevap

2

kullanarak sonucunu saklamak itask=2 kullanmak için bir talimat ve varsayılan itask=1. Farklı itask=1 veya itask=2 için ne olup bittiğini hakkında bir açıklama bulamazsınız scipy 0.12.0 belgelerinde

r._integrator.runner? 

, but you can find it here:

ITASK = An index specifying the task to be performed. 
!   Input only. ITASK has the following values and meanings. 
!   1 means normal computation of output values of y(t) at 
!    t = TOUT(by overshooting and interpolating). 
!   2 means take one step only and return. 
!   3 means stop at the first internal mesh point at or 
!    beyond t = TOUT and return. 
!   4 means normal computation of output values of y(t) at 
!    t = TOUT but without overshooting t = TCRIT. 
!    TCRIT must be input as RUSER(1). TCRIT may be equal to 
!    or beyond TOUT, but not behind it in the direction of 
!    integration. This option is useful if the problem 
!    has a singularity at or beyond t = TCRIT. 
!   5 means take one step, without passing TCRIT, and return. 
!    TCRIT must be input as RUSER(1). 
İlgili konular