{{ message }}

Instantly share code, notes, and snippets.

# Paulo Roberto de Oliveira Castro prcastro

Created Nov 23, 2015
View coord.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 from pdfminer.pdfparser import PDFParser from pdfminer.pdfdocument import PDFDocument from pdfminer.pdfpage import PDFPage from pdfminer.pdfpage import PDFTextExtractionNotAllowed from pdfminer.pdfinterp import PDFResourceManager from pdfminer.pdfinterp import PDFPageInterpreter from pdfminer.pdfdevice import PDFDevice from pdfminer.layout import LAParams from pdfminer.converter import PDFPageAggregator import pdfminer
Created Aug 26, 2014
Newton Method
View newton.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 function newton(f::Function, df::Function, x::Real, precision::Float64 = 10.0^(-6)/5.00) x_prox = x - f(x)/df(x) i = 1 while abs(x_prox - x) >= precision x = x_prox x_prox = x - f(x)/df(x) i += 1 end println("Numero de iterações: ", i)
Last active Aug 29, 2015
hb_diagram for Ising Module
View hb_diagram.jl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 # Phase diagram (magnetization by temperature) using heat bath algorithm function hb_diagram(;n::Int=20, m::Int=50, max::Float64=6.0, h::Float64 = 0.0, iters::Int=50000, ε::Float64 = 0.001, plot::Bool=true, verbose::Bool=true) temps = Array(Float64, n) mags = Array(Float64, n) i = 1 for temp in linspace(0.5, max, n) avgmag = mean([heatbath!(spinarray(n), h=h, temp=temp, iters=iters, ε=ε, plot=false, verbose=false)[end] for i in 1:m]) if verbose println("(T=\$temp) Avg. magnetization after heat bath \$avgmag") end temps[i] = t mags[i] = avgmag