scikits.bvp_solver generates ValueError: too many values to unpack

scikits.bvp_solver generates ValueError: too many values to unpack

我将从一个非常简单的 ODE 开始,它使用 scikits.bvp_solver 生成与我应用于复杂 ODE 相同的错误代码。以下是 ODE 和边界条件:

f''''(x)=f(x), f(0)=0, f'(1)=1, f''(0)=1, f'''(1)=1

求解此ODE的代码:

import numpy
import scikits.bvp_solver as bvp
def Fode(x,y):
    return numpy.array([y[1],y[2],y[3],y[0]])
def Fbc(ya,yb):
    return (numpy.array([ya[0]]),numpy.array([yb[1]-1]),
            numpy.array([ya[2]-1]),numpy.array([yb[3]-1]))
guess=numpy.array([0.0,0.0,0.0,0.0])

problem=bvp.ProblemDefinition (num_ODE=4,num_parameters=0,
                               num_left_boundary_conditions=2,
                               boundary_points=(0,1),
                               function=Fode,boundary_conditions=Fbc)
solution=bvp.solve(bvp_problem=problem,solution_guess=guess)

当我 运行 此代码时,我收到:

我不知道问题出在哪里,因为相同的代码适用于二阶 ODE。欢迎任何评论。

您的 Fbc 函数应该 return 恰好是两个数组,一个包含左侧边界条件的函数值差异,另一个包含右侧的值。

https://pythonhosted.org/scikits.bvp_solver/tutorial.html#defining-the-problem

https://pythonhosted.org/scikits.bvp_solver/examples/examples.example4.html