Ficheiro:Green's function animation.gif

O conteúdo da página não é suportado noutras línguas.
Origem: Wikipédia, a enciclopédia livre.

Imagem numa resolução maior(640 × 640 píxeis, tamanho: 1,69 MB, tipo MIME: image/gif, cíclico, 202 quadros, 20 s)

Descrição do ficheiro

Descrição
English: An intuitive animation that shows how Green's functions that solve a differential equation subject to a point-like source can be superposed to solve it subject to an arbitrary source.
Data
Origem Obra do próprio
Autor Hersle

Julia code

using LinearAlgebra
using Plots
using Printf

function solve(f; x1=0, x2=1)
	N = length(f)
	x = Array(range(x1, x2, length=N))
	h = x[2] - x[1]
	diag = fill(+2/h^2, N-2)
	semidiag = fill(-1/h^2, N-3)
	L = Tridiagonal(semidiag, diag, semidiag)
	u = L \ f[2:end-1]
	u = cat([0], u, [0], dims=1)
	return x, u
end

function animate()
	# Store all Green's function solutions
	N = 101
	U = zeros(N, N)
	p = plot()
	for i in 1:N
		f = [i == j ? 1 : 0 for j in 1:N]
		x, u = solve(f)
		U[i,:] = u
		plot!(p, u)
	end

	# Solve a real problem
	f1 = exp.(-(x.-0.5).^2 / (2*0.01))
	x, u1 = solve(f1)
	u = zeros(N)

	barw = x[2]-x[1] # plot bars with no gap between them

	anim = @animate for i in 1:N
	    y = @sprintf("%.2f", (i-1) / (N-1)) # as string
		f2 = [i == j ? 1 : 0 for j in 1:N]
		x, u2 = solve(f2)
		u += u2 * f1[i]

		colors = [i == j ? :black : :red for j in 1:N]

		# for some reason, only (1599, 1600) gives a height that is divisible by 2 during mp4 generation
		plot(layout=(2, 2), size=(1599, 1600), xlims=(0,1), xticks=([0, 0.5, 1], ["\$0\$", "\$x\$", "\$1\$"]), yticks=nothing, bar_width=barw, titlefontsize=40, tickfontsize=40, framestyle=:box, grid=false, legend=nothing, margin=10Plots.mm, top_margin=0Plots.mm)

		# Plot point-source and Green's function solution
		bar!(subplot=1, x[i:i], f2[i:i],         color=:green,      linecolor=:green,     bar_width=barw, ylims=(0, 1.10), title="\$\\delta(x-$y)\$")
		bar!(subplot=2, x,      u2,              color=:darkgreen,  linecolor=:darkgreen, bar_width=barw, ylims=(0, 0.02), title="\$G(x,$y)\$")

		# Plot full source and full solution
		bar!(subplot=3, x[1:i],     f1[1:i],     color=:blue,      linecolor=:blue,       bar_width=barw, ylims=(0, 1.10), title="\$ \\hat{L}\\,(x) u(x) = f(x < $y) \$")
		bar!(subplot=3, x[i+1:end], f1[i+1:end], color=:lightgrey, linecolor=:lightgrey,  bar_width=barw, ylims=(0, 1.10))
		bar!(subplot=4, x,          u1,          color=:lightgrey, linecolor=:lightgrey,  bar_width=barw, ylims=(0, 0.06))
		bar!(subplot=4, x,          u,           color=:darkblue,  linecolor=:darkblue,   bar_width=barw, ylims=(0, 0.06), title="\$ u(x) = {\\int}_{0}^{$y} \\! f(x') \\, G(x,x') \\, \\mathrm{d} x' \$")
	end

	mp4(anim, "green.mp4", fps=5)
	run(`ffmpeg -i green.mp4 -vf "fps=10,scale=640:640:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 green.gif`)
end

animate()

Licenciamento

Eu, titular dos direitos de autor desta obra, publico-a com a seguinte licença:
w:pt:Creative Commons
atribuição partilha nos termos da mesma licença
A utilização deste ficheiro é regulada nos termos da licença Creative Commons Atribuição-CompartilhaIgual 4.0 Internacional.
Pode:
  • partilhar – copiar, distribuir e transmitir a obra
  • recombinar – criar obras derivadas
De acordo com as seguintes condições:
  • atribuição – Tem de fazer a devida atribuição da autoria, fornecer uma hiperligação para a licença e indicar se foram feitas alterações. Pode fazê-lo de qualquer forma razoável, mas não de forma a sugerir que o licenciador o apoia ou subscreve o seu uso da obra.
  • partilha nos termos da mesma licença – Se remisturar, transformar ou ampliar o conteúdo, tem de distribuir as suas contribuições com a mesma licença ou uma licença compatível com a original.

Legendas

Adicione uma explicação de uma linha do que este ficheiro representa

Elementos retratados neste ficheiro

retrata

Um valor sem um elemento no repositório Wikidata

Um valor sem um elemento no repositório Wikidata

Histórico do ficheiro

Clique uma data e hora para ver o ficheiro tal como ele se encontrava nessa altura.

Data e horaMiniaturaDimensõesUtilizadorComentário
atual21h27min de 21 de dezembro de 2022Miniatura da versão das 21h27min de 21 de dezembro de 2022640 × 640 (1,69 MB)HersleShow changing source values
17h36min de 16 de junho de 2021Miniatura da versão das 17h36min de 16 de junho de 2021640 × 640 (754 kB)HersleReduced size to enable automatic animation
12h48min de 16 de junho de 2021Miniatura da versão das 12h48min de 16 de junho de 2021960 × 961 (1,3 MB)HersleCross-wiki upload from en.wikipedia.org

A seguinte página usa este ficheiro:

Utilização global do ficheiro

As seguintes wikis usam este ficheiro: