A PHP Error was encountered

Severity: Warning

Message: fopen(/home/polpe/.phpsession/ci_session13cc1830a3f521fbcf098a541958f734ade04332): 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

Deep symbolic tricks

Teljes Matlab script (és live script) kiegészítő függvényekkel.
Tekintsd meg LiveEditor nézetben is!

File: deep_symbolic_tricks.m

Author: Peter Polcz ppolcz@gmail.com

Created on 2017. November 08.

Declare some symbolic scalar valued function

syms t x y z real

n = 2;
m = 3;

V = sym(zeros(2,3));
for i = 1:n
    for j = 1:m
        V(i,j) = str2sym(sprintf('V%d%d(t,x,y)',i,j));
    end
end

Array of symbolic scalar valued functions (indexable):

V, V(1,2)
Output:
V =
[ V11(t, x, y), V12(t, x, y), V13(t, x, y)]
[ V21(t, x, y), V22(t, x, y), V23(t, x, y)]
ans =
V12(t, x, y)

Array valued symbolic function (not indexable)

V(t,x,y) = V, V(3,1,2)
Output:
V(t, x, y) =
[ V11(t, x, y), V12(t, x, y), V13(t, x, y)]
[ V21(t, x, y), V22(t, x, y), V23(t, x, y)]
ans =
[ V11(3, 1, 2), V12(3, 1, 2), V13(3, 1, 2)]
[ V21(3, 1, 2), V22(3, 1, 2), V23(3, 1, 2)]

Convert back into an array of symbolic functions

V = V(t,x,y), V(1,3), dV = diff(V,x,y)
Output:
V =
[ V11(t, x, y), V12(t, x, y), V13(t, x, y)]
[ V21(t, x, y), V22(t, x, y), V23(t, x, y)]
ans =
V13(t, x, y)
dV =
[ diff(V11(t, x, y), x, y), diff(V12(t, x, y), x, y), diff(V13(t, x, y), x, y)]
[ diff(V21(t, x, y), x, y), diff(V22(t, x, y), x, y), diff(V23(t, x, y), x, y)]

Array valued symbolic function (not indexable), but the argument is other than previously

V(t,y,z) = V, V(1,2,3)
Output:
V(t, y, z) =
[ V11(t, x, y), V12(t, x, y), V13(t, x, y)]
[ V21(t, x, y), V22(t, x, y), V23(t, x, y)]
ans =
[ V11(1, x, 2), V12(1, x, 2), V13(1, x, 2)]
[ V21(1, x, 2), V22(1, x, 2), V23(1, x, 2)]

Substritute a concrete function into $V$ and $\frac{\partial^2 V}{\partial x \partial y}$

V12(t,x,y) = sin(x) * exp(-y)
V = subs(V), dV = subs(dV)
Output:
V12(t, x, y) =
exp(-y)*sin(x)
V(t, y, z) =
[ V11(t, x, y), exp(-y)*sin(x), V13(t, x, y)]
[ V21(t, x, y),   V22(t, x, y), V23(t, x, y)]
dV =
[ diff(V11(t, x, y), x, y),          -exp(-y)*cos(x), diff(V13(t, x, y), x, y)]
[ diff(V21(t, x, y), x, y), diff(V22(t, x, y), x, y), diff(V23(t, x, y), x, y)]

Solve Differential Algebraic Equations (DAE) in Matlab