-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcompute_FJ.m
More file actions
18 lines (13 loc) · 765 Bytes
/
compute_FJ.m
File metadata and controls
18 lines (13 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function [F,J] = compute_FJ(state, eta_bar, curvature, torsion, Dtilde, I2_over_B0, abs_G_over_B0)
sigma = state(1:end-1);
iota = state(end);
F = zeros(size(state,1),1);
F(1:end-1) = Dtilde * sigma ...
+ iota * ( (eta_bar*eta_bar*eta_bar*eta_bar) ./ (curvature .* curvature .* curvature .* curvature) + 1 + sigma .* sigma) ...
- 2 * (eta_bar*eta_bar) ./ (curvature .* curvature) .* (I2_over_B0 - torsion) * abs_G_over_B0;
F(end) = sigma(1) - 0.;
J = zeros(size(state,1));
J(1:end-1,end) = (eta_bar*eta_bar*eta_bar*eta_bar) ./ (curvature .* curvature .* curvature .*curvature) + 1 + sigma .* sigma;
J(1:end-1,1:end-1) = Dtilde + diag(iota * 2 * sigma);
J(end, 1) = 1;
end