Tartalomjegyzék

Meaning of involutive distribution

Teljes Matlab script kiegészítő függvényekkel.

File: involutive.m
Directory: 4_gyujtemegy/11_CCS/_2_nonlin-pannon/2018
Author: Peter Polcz (ppolcz@gmail.com)
Created on 2018. July 27.

Inherited from

file:   nonlin_distributions_coordinate_systems.m
author: Peter Polcz <ppolcz@gmail.com>
Created on 2017.06.04. Sunday, 14:57:05

Requires

vekanal_subsmesh.m

Polar coordinates

Canonic basis vectors in polar coordinates

syms x y real

Z = [x;y];

f_sym = [
    -y
    x
    ];

g_sym = [
    x
    y
    ] / sqrt(x^2 + y^2);

figure, hold on, grid on
Q1 = vekanal_quiver_sym(f_sym, Z, {0,8,9}, {-4,4,9}, 0.7);
Q2 = vekanal_quiver_sym(g_sym, Z, {0,8,9}, {-4,4,9}, 0.7);
title 'Canonic basis vectors in the polar coordinates'

Closed walk along the flow of f and g

br_fg = simplify(jacobian(g_sym,Z)*f_sym - jacobian(f_sym,Z)*g_sym)

f_fh = matlabFunction(f_sym,'vars',{'t' Z});
g_fh = matlabFunction(g_sym,'vars',{'t' Z});

T1 = [0.4 0.8 1.4];
T2 = [1 3 5];

phi0 = [
    -10
    -20
    -40
    ] * pi / 180;

r0 = [
    3
    2
    1
    ];

x0 = round([ r0.*cos(phi0) r0.*sin(phi0) ],2);

hold on
for i = 1:numel(T1)

    fprintf('Path %d starting from from (%g,%g):\n', i, x0(i,:))
    fprintf(' -   %g seconds along the flow of f(x,y)\n', T1(i))
    fprintf(' -   %g seconds along the flow of g(x,y)\n', T2(i))
    fprintf(' -   %g seconds along the flow of f(x,y) (i.e. moving backwards)\n', -T1(i))
    fprintf(' -   %g seconds along the flow of g(x,y) (i.e. moving backwards)\n\n', -T2(i))

    N = 1000;
    [~,p1] = ode45(f_fh, linspace(0,T1(i),N), x0(i,:)');
    [~,p2] = ode45(g_fh, linspace(0,T2(i),N), p1(end,:)');
    [~,p3] = ode45(@(t,x) -f_fh(-t,x), linspace(0,T1(i),N), p2(end,:)');
    [~,p4] = ode45(@(t,x) -g_fh(-t,x), linspace(0,T2(i),N), p3(end,:)');

    plot(p1(:,1),p1(:,2), 'Color', Q1.Color, 'LineWidth', 5),
    plot(p2(:,1),p2(:,2), 'Color', Q2.Color, 'LineWidth', 5),
    plot(p3(:,1),p3(:,2), 'Color', Q1.Color, 'LineWidth', 5),
    plot(p4(:,1),p4(:,2), 'Color', Q2.Color, 'LineWidth', 5),

    plot(x0(i,1),x0(i,2),'ko', 'MarkerSize',10);

    pcz_arrow(p1(end/2,1),p1(end/2,2),p1(end/2+1,1),p1(end/2+1,2),'HeadLength',14,'HeadWidth',14)
    pcz_arrow(p2(end/2,1),p2(end/2,2),p2(end/2+1,1),p2(end/2+1,2),'HeadLength',14,'HeadWidth',14)
    pcz_arrow(p3(end/2,1),p3(end/2,2),p3(end/2+1,1),p3(end/2+1,2),'HeadLength',14,'HeadWidth',14)
    pcz_arrow(p4(end/2,1),p4(end/2,2),p4(end/2+1,1),p4(end/2+1,2),'HeadLength',14,'HeadWidth',14)
end
axis equal
axis tight
Output:
br_fg =
 0
 0
Path 1 starting from from (2.95,-0.52):
 -   0.4 seconds along the flow of f(x,y)
 -   1 seconds along the flow of g(x,y)
 -   -0.4 seconds along the flow of f(x,y) (i.e. moving backwards)
 -   -1 seconds along the flow of g(x,y) (i.e. moving backwards)

Path 2 starting from from (1.88,-0.68):
 -   0.8 seconds along the flow of f(x,y)
 -   3 seconds along the flow of g(x,y)
 -   -0.8 seconds along the flow of f(x,y) (i.e. moving backwards)
 -   -3 seconds along the flow of g(x,y) (i.e. moving backwards)

Path 3 starting from from (0.77,-0.64):
 -   1.4 seconds along the flow of f(x,y)
 -   5 seconds along the flow of g(x,y)
 -   -1.4 seconds along the flow of f(x,y) (i.e. moving backwards)
 -   -5 seconds along the flow of g(x,y) (i.e. moving backwards)

Pair of non-involutive vector fields

Vector fields

syms x y real

Z = [x;y];

f_sym = [
    -y
    x^3
    ];

g_sym = [
    x
    y
    ] / sqrt(x^2 + y^2);

figure, hold on, grid on
Q1 = vekanal_quiver_sym(f_sym, Z, {0,8,9}, {-4,4,9}, 0.7);
Q2 = vekanal_quiver_sym(g_sym, Z, {0,8,9}, {-4,4,9}, 0.7);
title 'Canonic basis vectors in the cycloid coordinates'

The walk along the flow of f and g is not closed

br_fg = simplify(jacobian(g_sym,Z)*f_sym - jacobian(f_sym,Z)*g_sym)

f_fh = matlabFunction(f_sym,'vars',{'t' Z});
g_fh = matlabFunction(g_sym,'vars',{'t' Z});

T1 = [0.05 ];
T2 = [2 3 1];

phi0 = [
    -10
    -20
    -40
    ] * pi / 180;

r0 = [
    3
    2
    1
    ];

x0 = round([ r0.*cos(phi0) r0.*sin(phi0) ],2);

hold on
for i = 1:numel(T1)

    fprintf('Path %d starting from from (%g,%g):\n', i, x0(i,:))
    fprintf(' -   %g seconds along the flow of f(x,y)\n', T1(i))
    fprintf(' -   %g seconds along the flow of g(x,y)\n', T2(i))
    fprintf(' -   %g seconds along the flow of f(x,y) (i.e. moving backwards)\n', -T1(i))
    fprintf(' -   %g seconds along the flow of g(x,y) (i.e. moving backwards)\n\n', -T2(i))

    N = 1000;
    [~,p1] = ode45(f_fh, linspace(0,T1(i),N), x0(i,:)');
    [~,p2] = ode45(g_fh, linspace(0,T2(i),N), p1(end,:)');
    [~,p3] = ode45(@(t,x) -f_fh(-t,x), linspace(0,T1(i),N), p2(end,:)');
    [~,p4] = ode45(@(t,x) -g_fh(-t,x), linspace(0,T2(i),N), p3(end,:)');

    plot(p1(:,1),p1(:,2), 'Color', Q1.Color, 'LineWidth', 5),
    plot(p2(:,1),p2(:,2), 'Color', Q2.Color, 'LineWidth', 5),
    plot(p3(:,1),p3(:,2), 'Color', Q1.Color, 'LineWidth', 5),
    plot(p4(:,1),p4(:,2), 'Color', Q2.Color, 'LineWidth', 5),

    plot(x0(i,1),x0(i,2),'ko', 'MarkerSize',10);

    pcz_arrow(p1(end/2,1),p1(end/2,2),p1(end/2+1,1),p1(end/2+1,2),'HeadLength',14,'HeadWidth',14)
    pcz_arrow(p2(end/2,1),p2(end/2,2),p2(end/2+1,1),p2(end/2+1,2),'HeadLength',14,'HeadWidth',14)
    pcz_arrow(p3(end/2,1),p3(end/2,2),p3(end/2+1,1),p3(end/2+1,2),'HeadLength',14,'HeadWidth',14)
    pcz_arrow(p4(end/2,1),p4(end/2,2),p4(end/2+1,1),p4(end/2+1,2),'HeadLength',14,'HeadWidth',14)
end
axis equal
axis tight
Output:
br_fg =
           -(x^2*y*(x^2 - 1))/(x^2 + y^2)^(3/2)
 -(2*x^5 + 3*x^3*y^2 - x*y^2)/(x^2 + y^2)^(3/2)
Path 1 starting from from (2.95,-0.52):
 -   0.05 seconds along the flow of f(x,y)
 -   2 seconds along the flow of g(x,y)
 -   -0.05 seconds along the flow of f(x,y) (i.e. moving backwards)
 -   -2 seconds along the flow of g(x,y) (i.e. moving backwards)

syms x1 x2 x3 real
x = [x1;x2;x3];

tau1 = [
    cos(x3)
    sin(x3)
    0
    ];
tau2 = [
    0
    0
    1
    ];

jacobian(tau2,x)*tau1 - jacobian(tau1,x)*tau2


f_sym = @(t,x) [
    sin(x(1))
    cos(x(2))
    ];
g_sym = @(t,x) [
    -cos(x(1))
    sin(x(2))
    ];

figure, hold on
for h = linspace(0.05,0.5,10)
    x0 = [1,1];
    N = 1000;
    [~,p1] = ode45(f_sym, linspace(0,h,N), x0);
    [~,p2] = ode45(g_sym, linspace(0,h,N), p1(end,:)');
    [~,p3] = ode45(@(t,x) -f_sym(-t,x), linspace(0,h,N), p2(end,:)');
    [~,p4] = ode45(@(t,x) -g_sym(-t,x), linspace(0,h,N), p3(end,:)');

    plot(p1(:,1),p1(:,2)),
    plot(p2(:,1),p2(:,2)),
    plot(p3(:,1),p3(:,2)),
    plot(p4(:,1),p4(:,2)),
end
Output:
ans =
  sin(x3)
 -cos(x3)
        0