View least_squares.py
"""
Basic Least Squares Implementation with pseudo inverse
"""
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(0)
t = np.linspace(0, 3, 20) # horizontal axis
x = np.array([3, 0, 4]) # a,b,c of f(t)=a+b*t+c*t^2
f = lambda t, x: x[0]+x[1]*t+x[2]*t**2 # f(t)
View st.py
# -*- encoding: utf-8 -*-
import sys
import os
import matplotlib.pyplot as plt
import numpy as np # instead of math
def getFullPath(fileName, fileType):
return (os.getcwd() + '\\' + '{}.{}').format(fileName, fileType)
View Brackets.java
public class Braces {
public static void main(String[] args) {
for (String line : args) {
System.out.println(isValidBracketsSeq(line));
}
}
static boolean isValidBracketsSeq(String brackets) {
View Automata.java
public class Automata {
public static void main(String[] args) {
for (String chain : args) {
System.out.println(isValidAssignmentChain(chain));
}
}
public static boolean isValidAssignmentChain(String chain) {
View InputHandler.java
public class InputHandler {
// clears the screen
public static void clearScreen() {
final String ANSI_CLS = "\u001b[2J";
final String ANSI_HOME = "\u001b[H";
System.out.print(ANSI_CLS + ANSI_HOME);
System.out.flush();
}
}
View binarySearch.c
#include <stdio.h>
#include <math.h>
#define true 1
typedef double (*mathFn)(double);
const double EPS = 1e-9;
View Braces.hpp
#include <string>
// #include <algorithm>
// #include <iostream>
#include <vector>
#include <map>
#include <stack>
// #pragma once
#ifndef BRACES_H
View decToRoman.cpp
#include <map>
#include <string>
std::string decimalToRoman(int n) {
std::string roman = "";
const std::map<int, std::string> rd = {
{1000, "M"},
{900, "CM"},
{500, "D"},
{400, "CD"},