Vonalintegrálok

F[{x_, y_, z_}]:=-(({x, y, z})/((x^2)+(y^2)+(z^2)))
A1={1, 0, 0};
A2={0.7, 0.5, 1};
A3={0, 0, -1};
γ[t_]:=(((1-t))^2)A1+2t(1-t)A2+(t^2)A3
Show[
VectorPlot3D[F[{x, y, z}], {x, -1, 1}, {y, -1, 1}, {z, -1, 1}],
ParametricPlot3D[γ[t], {t, 0, 1}, PlotStyle->Directive[Thick, Red], BoxRatios->{1,1,1}]
]

Manipulate[
Show[
ParametricPlot3D[γ[t], {t, 0, 1}, PlotStyle->Directive[Thick, Red], BoxRatios->{1,1,1}],
Graphics3D[{
PointSize[0.02],
Point[{A1, A3}],
PointSize[0.015],
Point[γ[x]],
Thickness[0.005],
Arrowheads[.06],
Arrow[Tube@{γ[x], γ[x]+γ'[x]}],
Blue,
Arrow[Tube@{γ[x], γ[x]+F[γ[x]]}],
Gray,
Line[{γ[x]+F[γ[x]], γ[x]+(F[γ[x]].Normalize[γ'[x]])Normalize[γ'[x]]}],
Line[{γ[x], γ[x]+(F[γ[x]].Normalize[γ'[x]])Normalize[γ'[x]]}]
}]
, PlotRange->{{-2, 2}, {-2, 2}, {-2, 2}}]
,{x, 0, 1}]

Felületi Integrálok

S[u_, v_]:={u, v, 1+(1/3)Sin[Pi u v]}
ParametricPlot3D[{S[u, v], {u, v, 0}}, {u, -1, 1}, {v, -1, 1}, PlotStyle->{Green, Opacity[0]}, Mesh->10, AxesLabel->{u, v, z}]

Show[
ParametricPlot3D[S[u, v], {u, -1, 1}, {v, -1, 1}, PlotStyle->Directive[Green, Opacity[0.5]], Mesh->10,RegionFunction->(((#1)^2)+((#2)^2)≥(0.9^2)&)],
ParametricPlot3D[S[u, v], {u, -1, 1}, {v, -1, 1}, PlotStyle->Green, Mesh->10,RegionFunction->(((#1)^2)+((#2)^2)≤(0.9^2)&)],
ParametricPlot3D[{u, v, 0}, {u, -1, 1}, {v, -1, 1}, PlotStyle->Opacity[0], Mesh->10, RegionFunction->(((#1)^2)+((#2)^2)≤0.9&)],
ParametricPlot3D[{{0.9Cos[ϕ],0.9Sin[ϕ], 0},{0,0,0.01}+S[0.9Cos[ϕ],0.9Sin[ϕ]]}, {ϕ, 0, 2Pi}, PlotStyle->Directive[Black, Thick]],
PlotRange->{{-1, 1}, {-1, 1}, {0, 1.5}}
]

D[S[u, v], u]
D[S[u, v], v]
Simplify[Cross[D[S[u, v], u],D[S[u, v], v]]]

n[u_, v_]:={-(1/3) π v Cos[π u v],-(1/3) π u Cos[π u v],1}
Manipulate[
Show[
ParametricPlot3D[S[u, v], {u, -1, 1}, {v, -1, 1}, PlotStyle->Green, Mesh->None],
ParametricPlot3D[{{0,0,0.01}+S[U[[1]], t], {0,0,0.01}+S[t, U[[2]]]}, {t, -1, 1}, PlotStyle->Directive[Black, Thick]],
Graphics3D[{
Arrowheads[0.05],
Thickness[0.005],
Arrow@Tube@{S@@U, S@@U+n@@U},
Blue,
Arrow@Tube@{S@@U, S@@U-F[S@@U]},
Gray,
Line[{S@@U-F[S@@U], S@@U-(F[S@@U].Normalize[n@@U])Normalize[n@@U]}],
Line[{S@@U, S@@U-(F[S@@U].Normalize[n@@U])Normalize[n@@U]}]
}]
,PlotRange->{{-1, 1}, {-1, 1},{0, 2.5}}
]
,{U,{1,1},{-1,-1}}]

Vektormezők

Rotációmentes

v[x_, y_, z_]:=(({x, y, z})/((x^2)+(y^2)+(z^2)))
Simplify[Derivative[1,0,0][v][x,y,z][[1]]+Derivative[0,1,0][v][x,y,z][[2]]+Derivative[0,0,1][v][x,y,z][[3]]]
{Derivative[0,1,0][v][x,y,z][[3]]-Derivative[0,0,1][v][x,y,z][[2]], Derivative[0,0,1][v][x,y,z][[1]]-Derivative[1,0,0][v][x,y,z][[3]], Derivative[1,0,0][v][x,y,z][[2]]-Derivative[0,1,0][v][x,y,z][[1]]}

VectorPlot3D[v[x, y, z], {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, AxesLabel->{x, y, z}]

Divergenciamentes

v[x_, y_, z_]:={-y, x, 1}
Derivative[1,0,0][v][x,y,z][[1]]+Derivative[0,1,0][v][x,y,z][[2]]+Derivative[0,0,1][v][x,y,z][[3]]
{Derivative[0,1,0][v][x,y,z][[3]]-Derivative[0,0,1][v][x,y,z][[2]], Derivative[0,0,1][v][x,y,z][[1]]-Derivative[1,0,0][v][x,y,z][[3]], Derivative[1,0,0][v][x,y,z][[2]]-Derivative[0,1,0][v][x,y,z][[1]]}

VectorPlot3D[v[x, y, z], {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, AxesLabel->{x, y, z}]

Rotáció- és Divergenciamentes

v[x_, y_, z_]:={2x+3y+4z, 3x-2y+z, 4x+y}
Derivative[1,0,0][v][x,y,z][[1]]+Derivative[0,1,0][v][x,y,z][[2]]+Derivative[0,0,1][v][x,y,z][[3]]
{Derivative[0,1,0][v][x,y,z][[3]]-Derivative[0,0,1][v][x,y,z][[2]], Derivative[0,0,1][v][x,y,z][[1]]-Derivative[1,0,0][v][x,y,z][[3]], Derivative[1,0,0][v][x,y,z][[2]]-Derivative[0,1,0][v][x,y,z][[1]]}

VectorPlot3D[v[x, y, z], {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, AxesLabel->{x, y, z}]

Diffegyenletek Numerikus megoldása

Euler - féle töröttvonal módszer

ExplicitEuler[x0_, h_,T_, F_]:=Module[{L=NestList[{#[[1]]+h F[#[[1]], #[[2]]], #[[2]]+h}&, {x0, 0}, Ceiling[(T/h)]]},
L=#[[1]]&/@L;
{Point@L,
Line@L
}
]

y'=4 y(1-y)

F[{x_, y_ },t_]:={1, 4y(1-y)}

Manipulate[
Show[
VectorPlot[F[{x, y}, 0], {x, 0, 10}, {y, 0, 1}],
Graphics[
ExplicitEuler[p[[1]], h,T, F[#1, #2]&]
]
]
, {{p, {{0, 1/Pi}}}, Locator, LocatorAutoCreate->True}, {{T, 5}, 0, 10}, {{h, 0.1}, 0, 1}]

({{x'=, -y}, {y'=, x-(1/2)y}})

F[{x_, y_ },t_]:={-y, x-y/2}

Manipulate[
Show[
VectorPlot[F[{x, y}, 0], {x, -1, 1}, {y, -1, 1}],
Graphics[
ExplicitEuler[p[[1]], h,T, F[#1, #2]&]
]
]
, {{p, {{0, 1}}}, Locator, LocatorAutoCreate->True}, {{T, 1}, 0, 10}, {{h, 0.1}, 0, 1}]

Szukcesszív Approximáció

Picard[f_, {x0_, y0_}, n_]:=NestList[y0+ ((∫_x0^x)f[(#/.x->t), t]\[DifferentialD]t)&,y0,n]

y'=x y

Picard[#1 #2&,{0, 1}, 3]
Show[
Plot[
%
,{x, 0, 1},PlotStyle->Directive[Blue, Thickness[0.005]]],
Plot[y[ξ]/.DSolve[{y'[x]==x y[x], y[0]==1},y, x][[1]], {ξ, 0, 1}, PlotStyle->Red, PlotRange->All]
]

Általános

NDES[F_, Range_, T_?Positive]:=Module[{},
Manipulate[
Show[
VectorPlot[{F[x, y, 0][[1]],F[x, y, 0][[2]]}, {x, Range[[1,1]], Range[[1, 2]]}, {y, Range[[2, 1]], Range[[2, 2]]}, Axes->True],
ParametricPlot[Evaluate[{x[t],y[t]}/.NDSolve[{x'[t]==F[x[t], y[t], t][[1]], y'[t]==F[x[t], y[t], t][[2]],x[0]==#[[1]], y[0]==#[[2]]},{x,y},{t,0,T},Method->"ExplicitRungeKutta"]],{t,0,T}, PlotRange->Range[[2]], ColorFunction->Function[{x,y,t},RGBColor[Norm[F[x, y, t]], 0, 1-Norm[F[x, y, t]]]], ColorFunctionScaling->False
]&/@p
]
, {{p,{{0,0}}},Locator,LocatorAutoCreate->True}
]
]

2. PótZH

({{x'=, -7x+y+(e^t)}, {y'=, -2x-5y+2 (e^t)}})

NDES[{-7#1+#2+(E^(#3)),-2#1-5#2+2 (E^(#3))}&, {{-1, 1}, { -1, 1}},2]

Lotka - Volterra féle zsákmány - ragadozó modell

({{x'=, x(1-y)}, {y'=, -y(1-x)}})

NDES[{#1(1-#2),-#2(1-#1)}&, {{0, 3}, {0, 3}},4]

Rezonancia

({{x'=, y}, {y'=, -x-μ y+A sin(t)}})

Manipulate[
NDES[{#2,-#1-μ#2+A Sin[#3]}&, {{-1, 1}, {-1, 1}},T]
,{μ, 0, 1}, {A, 0, 1}, {{T, 4}, 0, 20}]

Lorentz attraktor

NDES3D[F_, Range_, T_?Positive]:=Manipulate[Show[ParametricPlot3D[Evaluate[{x[t],y[t], z[t]}/.NDSolve[{x'[t]==F[x[t], y[t],z[t]][[1]],y'[t]==F[x[t], y[t],z[t]][[2]], z'[t]==F[x[t], y[t],z[t]][[3]],x[0]==X, y[0]==Y, z[0]==Z},{x,y, z},{t,0,T}, Method->"ExplicitRungeKutta"]],{t,0,T} ,ColorFunction->Function[{x,y, z},RGBColor[((Sqrt[(((F[x, y, z][[1]]))^2)+(((F[x, y, z][[2]]))^2)+(((F[x, y, z][[3]]))^2)])/2), 0, 1-((Sqrt[(((F[x, y, z][[1]]))^2)+(((F[x, y, z][[2]]))^2)+(((F[x, y, z][[3]]))^2)])/2)]], ColorFunctionScaling->False, PlotRange->Range, AxesLabel->{x, y,z}], Graphics3D[{Orange,Sphere[{X, Y, Z}, 0.1]}]],{X,Range[[1, 1]], Range[[1, 2]]},{Y,Range[[2, 1]], Range[[2, 2]]},{Z,Range[[3, 1]], Range[[3, 2]]}]

NDES3D[{10(#2-#1),  #1(28-#3)-#2, #1 #2-(8/3)#3}&, {{-20, 20}, {-20, 20}, {0, 40}}, 20]

Parciális Differenciál Egyenletek

kihülés

Sol1=NDSolve[{Derivative[1,0][u][t,x]==5Derivative[0,2][u][t,x], u[0, x]==((4-(x^2))/32)(((x+2))^2), u[t, -2]==u[t, 2]==0}, u, {t, 0, 1}, {x, -2, 2}][[1]];
Manipulate[
Show[
Plot[u[t, x]/.Sol1, {x, -2, 2}, PlotRange->{0, 1}],
Graphics[{
Red,
Arrowheads[0.03],
Table[Arrow[{{x, u[t, x]}, {x-Derivative[0,1][u][t,x], u[t, x]}}/.Sol1], {x, -2, 2, If[Hőáram, 0.2, 4]}]
}]
]
, {t, 0, 1}, {Hőáram, {False, True}}]

hővezetés

Sol2=NDSolve[{Derivative[1,0][u][t,x]==5Derivative[0,2][u][t,x], u[0, x]==(((((x+2))^2)(((x-2))^4))/128), Derivative[0,1][u][t, -2]==Derivative[0,1][u][t, 2]==0}, u, {t, 0, 1}, {x, -2, 2}][[1]];
Manipulate[
Show[
Plot[u[t, x]/.Sol2, {x, -2, 2}, PlotRange->{0, 1}],
Graphics[{
Red,
Arrowheads[0.03],
Table[Arrow[{{x, u[t, x]}, {x-Derivative[0,1][u][t,x], u[t, x]}}/.Sol2], {x, -2, 2, If[Hőáram, 0.2, 4]}]
}]
]
, {t, 0, 1}, {Hőáram,{False, True}}]

Hőforrások

Sol3=NDSolve[{Derivative[1,0][u][t,x]==5Derivative[0,2][u][t,x]+(((((x+2))^3)(((x-2))^2))/64), u[0, x]==(((((x+2))^2)(((x-2))^4))/128), u[t, -2]==u[t, 2]==0}, u, {t, 0, 2}, {x, -2, 2}][[1]];
Manipulate[
Show[
Plot[{u[t, x]/.Sol3, (((((x+2))^3)(((x-2))^2))/64)}, {x, -2, 2}, PlotRange->{0, 1}],
Graphics[{
Red,
Arrowheads[0.03],
Table[Arrow[{{x, u[t, x]}, {x-Derivative[0,1][u][t,x], u[t, x]}}/.Sol3], {x, -2, 2, If[Hőáram, 0.2, 4]}]
}]
]
, {t, 0, 2}, {Hőáram,{False, True}}]

2. fajú Lagrange Egyenletek

DoublePendulum[ψ_, Θ_]:=Graphics[{GrayLevel[.5],Line[{{0,0},{Sin[ψ], -Cos[ψ]}}],Line[{{Sin[ψ], -Cos[ψ]}, {Sin[ψ]+Sin[Θ], -Cos[ψ]-Cos[Θ]}}],Dotted ,Brown, Line[{{-2-0.08, 2+0.08}, {-2-0.08, -2-0.08}}], Dashed, Black, Thick , Line[{{-2-0.08, 0}, {2+0.08, 0}}],Red,Disk[{Sin[ψ], -Cos[ψ]}, 0.08], Disk[{Sin[ψ]+Sin[Θ], -Cos[ψ]-Cos[Θ]}, 0.08]}]

Manipulate[
Animate[
DoublePendulum@@Evaluate[{ψ[T],Θ[T]}/.(Sol4=NDSolve[{
19.62  Sin[ψ[t]]-Sin[Θ[t]-ψ[t]] ((Θ'[t])^2)+Cos[Θ[t]-ψ[t]] Θ''[t]+2 ψ''[t]==0,9.81 Sin[Θ[t]]+Θ''[t]+Cos[Θ[t]-ψ[t]] ψ''[t]==-Sin[Θ[t]-ψ[t]] ((ψ'[t])^2),
 ψ'[0]==Ψ0,Θ'[0]== Ξ0, ψ[0]==ψ0,Θ[0]==Θ0},{ψ, Θ}, {t, 0, 20}, Method->"ExplicitRungeKutta"])][[1]]
,{T, 0,  20}, AnimationRate->0.7 ,AnimationRunning->False],
{{ψ0,0}, -Pi, Pi},
{{Θ0,0}, -Pi, Pi},
{{Ψ0, 0},-2, 2},
{{Ξ0, 0},-2, 2}]