You need that first line to read
{x, y}::Coordinate;
(mind the comma),
Thank you for pointing out this error.
and you also have to add
V::Depends(x,y);
Ah.
With the correction and addition the code is
{x, y}::Coordinate;
{i, j, k, l, m, n, h#}::Integer(0..1);
{i, j, k, l, m, n, h#}::Indices(values={x, y}, position=fixed);
\partial{#}::PartialDerivative;
g_{i j}::Metric.
g^{i j}::InverseMetric.
# Hénon-Heiles Hamiltonian potential: V
V::Depends(x, y);
V := (x**2 + y**2)/2 + (x**2)*y - (y**3)/3;
# Ho is a constant of the motion: conservation of energy
metric := { g_{x x} = 2*(Ho - V),
g_{y y} = 2*(Ho - V) };
complete(metric, $g^{i j}$);
Christoffel := \Gamma^{i}_{j k} = (1/2)*g^{i l}*( \partial_{k}{g_{l j}}
+ \partial_{j}{g_{l k}}
- \partial_{l}{g_{j k}} );
evaluate(Christoffel, metric, rhsonly=True);
The modified code now runs fine.
However,
evaluate(Christoffel, metric, rhsonly=True)
returns the partial derivatives of V in symbolic form,
i.e, the partial derivatives of V are not explicitly calculated. Spent some time experimenting, but no success.
If I insert the explicit expression for V(x, y) into the metric, the expected result is returned.
{x, y}::Coordinate;
{i, j, k, l, m, n, h#}::Integer(0..1);
{i, j, k, l, m, n, h#}::Indices(values={x, y}, position=fixed);
\partial{#}::PartialDerivative;
g_{i j}::Metric.
g^{i j}::InverseMetric.
# Hénon-Heiles Hamiltonian potential: V
# V::Depends(x, y);
# V := ((x**2 + y**2)/2 + (x**2)*y - (y**3)/3);
# Ho is a constant of the motion: conservation of energy
metric := { g_{x x} = 2*(Ho - ((x**2 + y**2)/2 + (x**2)*y - (y**3)/3)),
g_{y y} = 2*(Ho - ((x**2 + y**2)/2 + (x**2)*y - (y**3)/3)) };
complete(metric, $g^{i j}$);
Christoffel := \Gamma^{i}_{j k} = (1/2)*g^{i l}*( \partial_{k}{g_{l j}}
+ \partial_{j}{g_{l k}}
- \partial_{l}{g_{j k}} );
evaluate(Christoffel, metric, rhsonly=True);
If possible, however, I'd prefer to use the general form approach and force evaluation of the derivative.
Will post an working example tomorrow with some other comments.
Thank you. Looking forward to your example and comments.