A PHP Error was encountered

Severity: Warning

Message: fopen(/home/polpe/.phpsession/ci_session62ca75753b8623b9ea266a029067d5025702eb6f): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 159

Backtrace:

File: /home/polpe/public_html/application/controllers/Main.php
Line: 17
Function: library

File: /home/polpe/public_html/index.php
Line: 315
Function: require_once

Polcz Péter honlapja

Tartalomjegyzék

Script anal3_diffgeom_tenzor_polar_1

TELJES MATLAB SCRIPT KIEGÉSZÍTŐ FÜGGVÉNYEKKEL

file:   anal3_diffgeom_tenzor_polar_1.m
author: Peter Polcz <ppolcz@gmail.com>
Created on 2017.08.08. Tuesday, 02:56:40
try c = evalin('caller','persist'); catch; c = []; end
persist = pcz_persist(mfilename('fullpath'), c); clear c;
persist.backup();
%clear persist
Output:
│   - Persistence for `anal3_diffgeom_tenzor_polar_1` initialized [run ID: 9633, 2017.08.27. Sunday, 05:02:54]
│   - Script `anal3_diffgeom_tenzor_polar_1` backuped

Polárkoordináta rendszer bázisvektorai

A polárkoordináták mögé odaképzeljuk a Descartes coordinátákat.

% r: sugar
% t: theta
syms x y z r t p real
Z = [ r ; t ];

R = [
    r*cos(t)
    r*sin(t)
    ];

$\vec Z_i$ bázisvektorok külön-külön számolva

Zr = diff(R,r)
Zt = diff(R,t)
Output:
Zr =
 cos(t)
 sin(t)
Zt =
 -r*sin(t)
  r*cos(t)

Kovariáns $\vec Z_i$ bázisvektorok (oszloposan)

Z_i = jacobian(R,Z)
Output:
Z_i =
[ cos(t), -r*sin(t)]
[ sin(t),  r*cos(t)]

Kovariáns $Z_{ij}$ metrika tenzor

Z_ij = simplify(Z_i'*Z_i)
Output:
Z_ij =
[ 1,   0]
[ 0, r^2]

Kontravariáns $Z_{ij}$ metrika tenzor

Zij = inv(Z_ij)
Output:
Zij =
[ 1,     0]
[ 0, 1/r^2]

Christoffel szimbólum $\Gamma_{ij}^k$

n = numel(Z);
Gamma = sym(zeros(n,n,n));

for k = 1:n % delta spans the variable labels over which symbols will be calculated
  for j = 1:n
    for i = 1:n
      for m = 1:n
        Gamma(i,j,k) = Gamma(i,j,k) + 0.5 * Zij(k,m) * ( ...
          diff(Z_ij(m,i), Z(j)) + diff(Z_ij(m,j), Z(i)) - diff(Z_ij(i,j), Z(m)) ...
          );
      end
    end
  end
end
Gamma
Output:
Gamma(:,:,1) = 
[ 0,  0]
[ 0, -r]
Gamma(:,:,2) = 
[   0, 1/r]
[ 1/r,   0]

Divergencia polárkoordinátákban

Először: kovariáns derivált számolása $\nabla_j V^i$, ahol $\vec V = V^1 \vec Z_r + V^2 \vec Z_\theta$.

syms r t p real
Z = [r ; t];
n = numel(Z);

Vi = [
    sym('V1(r,t)')
    sym('V2(r,t)')
    ];

diff(Vi,t)

Nabla_jVi = jacobian(Vi,Z);

for j = 1:n
    for i = 1:n
        for m = 1:n
            Nabla_jVi(i,j) = Nabla_jVi(i,j) + ...
                Gamma(j,m,i)*Vi(m);
        end
    end
end

Nabla_jVi

div_Vi = trace(Nabla_jVi)
Output:
ans =
 diff(V1(r, t), t)
 diff(V2(r, t), t)
Nabla_jVi =
[              diff(V1(r, t), r), diff(V1(r, t), t) - r*V2(r, t)]
[ diff(V2(r, t), r) + V2(r, t)/r, diff(V2(r, t), t) + V1(r, t)/r]
div_Vi =
diff(V1(r, t), r) + diff(V2(r, t), t) + V1(r, t)/r

Tehát $\nabla_i V^i = \pdv{V^1(r,\theta)}{r} + \pdv{V^2(r,\theta)}{\theta} + \frac{V^1(r,\theta)}{r}$

Laplace polárkoordinátákban

Először kiszámítjuk a $\nabla_i \nabla_j F(r,\theta)$ második kontravariáns deriváltat. Majd ezt követően a $\Delta F(r,\theta)$-t is megkapjuk a következő módon: $\Delta F(r,\theta) = Z^{ij} \nabla_i \nabla_j F(r,\theta)$.

Általános függvény:

F = sym('f(r,t)');

Nabla_iNabla_jF = sym(zeros(n,n));
for i = 1:n
    for j = 1:n
        Nabla_iNabla_jF(i,j) = diff(F,Z(i),Z(j));
        for k = 1:n
            Nabla_iNabla_jF(i,j) = Nabla_iNabla_jF(i,j) - Gamma(i,j,k) * diff(F,Z(k));
        end
    end
end

LaplaceF = sym(0);
for i = 1:n
    for j = 1:n
        LaplaceF = LaplaceF + Zij(i,j) * Nabla_iNabla_jF(i,j);
    end
end

expand(LaplaceF)
latex(ans)
Output:
ans =
diff(f(r, t), r)/r + diff(f(r, t), t, t)/r^2 + diff(f(r, t), r, r)
ans =
\frac{\frac{\partial}{\partial r} f\!\left(r,t\right)}{r} + \frac{\frac{\partial^2}{\partial t^2} f\!\left(r,t\right)}{r^2} + \frac{\partial^2}{\partial r^2} f\!\left(r,t\right)

Tehát $\Delta f(r,t) = $

Gradiens polárkoordinátákban

$\nabla F = \frac{\partial F}{\partial Z^j} Z^{ij} \vec Z_i$

Általános függvény:

F = sym('F(r,t)');

grad_Fi = sym(zeros(1,n));
grad_F = sym(zeros(n,1));
for i = 1:n
    for j = 1:n
        grad_Fi(i) = grad_Fi(i) + diff(F,Z(j)) * Zij(i,j);
    end
    grad_F = grad_F + grad_Fi(i) * Z_i(:,i)
end

grad_Fi
grad_F
Output:
grad_F =
 cos(t)*diff(F(r, t), r)
 sin(t)*diff(F(r, t), r)
grad_F =
 cos(t)*diff(F(r, t), r) - (sin(t)*diff(F(r, t), t))/r
 sin(t)*diff(F(r, t), r) + (cos(t)*diff(F(r, t), t))/r
grad_Fi =
[ diff(F(r, t), r), diff(F(r, t), t)/r^2]
grad_F =
 cos(t)*diff(F(r, t), r) - (sin(t)*diff(F(r, t), t))/r
 sin(t)*diff(F(r, t), r) + (cos(t)*diff(F(r, t), t))/r

pl.

F = sin(t) * exp(-r);
F = r;
subs(grad_Fi, 'F(r,t)', F)
subs(grad_F, 'F(r,t)', F)
Output:
ans =
[ 1, 0]
ans =
 cos(t)
 sin(t)

Kovariáns derivált számolása $\nabla_j V^i$, ahol $\vec V = V^1 \vec Z_r + V^2 \vec Z_\theta$, továbbá: $V^i = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$, ezért $\vec V = \vec Z_r$

Vi = [
    1
    0
    ];

Nabla_jVi = jacobian(Vi,Z);

for j = 1:n
    for i = 1:n
        for m = 1:n
            Nabla_jVi(i,j) = Nabla_jVi(i,j) + ...
                Gamma(j,m,i)*Vi(m);
        end
    end
end

div_Vi = trace(Nabla_jVi)
Output:
div_Vi =
1/r

Kiszámoljuk a divergenciáját Descartes koordináta rendszerben is!

syms x y real
Zp = [x ; y];

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

div_Vi = simplify(divergence(Vi,Zp))
Output:
div_Vi =
1/(x^2 + y^2)^(1/2)