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
{- | |
Module : Newton | |
Description : Newton method in Haskell | |
Copyright : (c) Fabricio Olivetti de Franca, 2017 | |
License : GPL-3 | |
Maintainer : fabricio.olivetti@gmail.com | |
A simple implementation of the Newton's method. | |
-} |
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
module Main where | |
newtype Identity a = Id a deriving Show | |
data DoubleF a = DoubleF a a deriving Show | |
instance Functor Identity where | |
fmap f (Id a) = Id (f a) | |
instance Functor DoubleF where | |
fmap f (DoubleF x y) = DoubleF (f x) (f y) |
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
module Main where | |
import qualified Data.Set as S | |
-- hasMorph p m and hasMorph p n | |
isValid :: (a -> a -> Bool) -> (a -> a -> a) -> a -> a -> Bool | |
isValid f op x y = f p x && f p y | |
where p = x `op` y | |
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
#!/usr/bin/python | |
# pip install pyinterval | |
# pip install kaucherpy | |
from interval import interval | |
from kaucherpy import * | |
# the implementation of (**) in kaucherpy is wrong | |
# I'm using as a reference: | |
# https://www.dropbox.com/s/z6dlq60rq5t009k/MIC%20v2.1.zip?dl=0&file_subpath=%2FMIC+v2.1%2Ffstar%2Finterval.m |
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
"""Example Scikit-learn compatible Python wrapper for a Symbolic Regression CLI. | |
This module demonstrates how to implement a python wrapper compatible with | |
scikit-learn for any Symbolic Regression CLI that returns a python compatible expression | |
in plain text. | |
This example assumes that your CLI allows to pass the parameters via command line | |
and that it returns a readable and python-compatible expression: | |
./bin/regressor 500 1000 0.3 0.7 42 |
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
import matplotlib.pyplot as plt | |
def SIR(S, I, beta, gamma, tot_time): | |
''' | |
S: susceptibles | |
I: infecteds | |
beta: contagion rate | |
gamma: recovery rate | |
tot_time: total time | |
''' |
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
{ | |
description = "ITEA"; | |
inputs.flake-utils.url = "github:numtide/flake-utils"; | |
inputs.nixpkgs.url = "github:nixos/nixpkgs/master"; | |
outputs = { self, nixpkgs, flake-utils }: | |
flake-utils.lib.eachDefaultSystem (system: | |
let | |
config = { | |
packageOverrides = pkgs: { |
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
{-# language DeriveTraversable #-} | |
{-# language LambdaCase #-} | |
{-# language TemplateHaskell #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module Main (main) where | |
import Data.Eq.Deriving |
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
#include <stdlib.h> | |
#include "lista.h" | |
#include "pilha.h" | |
PilhaDinamica *criar_pilha() { | |
PilhaDinamica *pilha = malloc(sizeof(PilhaDinamica)); | |
pilha->topo = NULL; | |
return pilha; | |
} |
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
#include <stdlib.h> | |
#include "lista.h" | |
#include "fila.h" | |
FilaDinamica *criar_fila() { | |
FilaDinamica *fila = malloc(sizeof(FilaDinamica)); | |
fila->inicio = NULL; | |
fila->fim = NULL; | |
return fila; | |
} |
OlderNewer