help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bvp4c.m Question


From: c.
Subject: Re: bvp4c.m Question
Date: Wed, 17 Apr 2013 20:06:01 +0200

Hi,

On 10 Apr 2013, at 15:40, eirikbloodaxe <address@hidden> wrote:

> I need help/clarification concerning bvp4c.m. The problem I want to solve is
> a Hamiltonian two point BVP of the form
> 
> dx/dt = del H / del p
> dp/dt = - del H / del x
> 
> where x and p have dimension, say, n and H(x, p), the Hamiltonian, is a
> function of x and p. `del' means partial derivative. The boundary values are
> x(t_start) = x0 and p(t_end) = 0, where x0 is some prescribed point in R^n.
> The problem has to do with finding optimal (minimum energy) controls.
> 
> I succesfully used bvp4c.m in matlab but I now want to switch to octave with
> this problem because I like octave more. I am not interested in 1-to-1
> compatibility with matlab, but I need to know more about bvp4c.m in octave
> in order to use it properly and recommend it to others.

As I pointed out in a previous (off-list) email bvp4c is not really functional 
yet, its
only use at the moment can be seen as that of a starting point for someone 
interested 
in completing its implementation.

Indeed there is a proposal to have a student to complete the implementation of 
bvp4c
within the GSoC 2013 program:

http://wiki.octave.org/Summer_of_Code_Project_Ideas#Implement_solver_for_1D_nonlinear_boundary_value_problems

If you know any interested students please encourage them to apply.

As things stand now, you definitely should not recommend the use of bvp4c in a 
"production" environment.

If you can rewrite your problem as a 2nd order equation it is very likely that 
you can solve it 
with a combination of the bim package and fsolve.

If you want info on how to do this you should write a less abstract, yet not 
too complicated,
 example of what you really intend to solve.

> Questions:
> 
> (1) My vector field has dimension 2*n, but bvp4c tries to evaluate it using
> a 2*n-times-3 matrix. Am I supposed to return the values of the vector field
> for each column of this 2*n-times-3 matrix? If yes, why 3? Can I tweak this
> number? My problem allows for massive economies in terms of evaluating the
> vector field at more than one point, but the number of points should
> preferrably be even.

I'm not really sure what you're really talking about here. 

The size of the matrix depends on the number of stages in 
RK methods used by bvp4c, there's not really much you can do 
about this.

why do you think you need to change this? can that be done in matlab's bvp4c? 
how?

> 
> (2) How do I provide derivatives of my boundary conditions and vector field?
> (I want to demonstrate to people that this improves the performance.)

how do you do that with matlab's bvp4c? you should be able to do the same with 
Octave's
implementation, if it doesn't work it's because it's not implemented yet, 
patches are welcome. 

> (3) I believe that bvp4c solves the collocation equations using fsolve. I'd
> like to extract more information about the collocation equations at the
> solution from fsolve (e.g. the Jacobian), but in order to interprete this
> information, I need to know precisely how the collocation equations are
> organised.

the discretization method is an implicit 3-stage Runge-Kutta method whos 
butcher tableau 
is given by the persistent variables A, B and C defined in the code.

what the current code does is just set up the whole non linear system of 
equations at 
all the collocation points and then let it to fsolve to solve the system.

> (4) Am I right in thinking that bvp4c is a fourth order scheme, so that
> there is an implicit assumption that (x, p) have temporal derivatives of up
> to order 4?

you can find a discussion of the convergence properties of the method in this 
paper:
http://dx.doi.org/10.1145/502800.502801

HTH,
c.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]