2013-03-20 1 views
6

의 단계 옵션을 활성화 문제 파이썬 - Scipy : ODE 모듈 : 그래서 while 루프를 한 <pre><code>solver1.integrate(t_end) </code></pre> <p></p>과 : 솔버 내가 그것을 호출 할 때 해결사 자체가 취한 다른 통합 단계를 저장하고 싶었

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

가 그럼 난 y, 통합의 결과 플롯 여기 내 문제 온다 : True 그 값을 설정하는 단계 옵션을 활성화. 나는 그것 때문에 그런 루프 또는 뭔가라고 생각

y enabling the step option of the solver

그래서 나는 step를 제거 결과를 확인 :

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

그리고 놀랍게도 나는 위치 영역에 표시 불안정성이있다.

y disabling the step option of the solver

그것은 그만이야 .. 나는 올바른 결과를 이상한 상황 ... 당신들 중 누군가가이 문제로 나를 도울 수 있다면 고맙겠습니다.

편집 :

내가 솔버를 설정하려면 :

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

그리고 난 당신이 step=True 당신이 간접적으로 vode._integrator.runner (포트란 서브 루틴)을주고있다을 설정하면 .append()

+0

수이 runner하는 것에 대해 더 자세한 정보를 얻을 수 있습니다 코드를 좀 더 보여주고, 솔버를 설정하고 플로팅을 위해 결과를 저장하는 방법을 보여줍니다. – silvado

+0

물론, 저는 제 질문을 편집했습니다. – kuider

+0

플롯이 ODE 상태 변수 중 하나를 표시한다고 가정하고 플로팅중인 현재 ODE 상태를 실제로 저장하는 방법을 아직 표시하지 않았습니다. – Nikolas

답변

2

를 사용하여 결과를 저장 itask=2을 사용하는 지침이며 기본값은 itask=1입니다. 당신이 다른 itask=1 또는 itask=2을 위해 무슨 일이 일어나고 있는지에 대한 설명을 찾을 수 없습니다 SciPy 0.12.0 문서에서

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).