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 std/sequtils | |
import std/strutils | |
import std/tables | |
type board = array[1..19, array[1..19, char]] | |
var table = initTable[string, int]() | |
var count:int = 0 | |
proc print(a:board) = |
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
# calculate coefficients of Newton-Cotes integral formula | |
# for \int_a^b f(x)dx | |
# using sampling points x0(=a), x1, ..., xn-1, xn(=b) | |
import sympy as sym | |
n = 7; | |
x = sym.Symbol('x'); | |
a = sym.Symbol('a'); |
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 <stdio.h> | |
#include <float.h> | |
#include <stdint.h> | |
#include <inttypes.h> | |
int64_t d2i(double x) | |
{ | |
union { | |
int64_t i; | |
double d; |
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 <iostream> | |
#include <cfenv> | |
#include <cmath> | |
int check_rounding() | |
{ | |
volatile double x, y, z; | |
x = 1; | |
y = pow(2., -55); |
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 <kv/kraw-approx.hpp> | |
#include <kv/defint.hpp> | |
namespace ub = boost::numeric::ublas; | |
typedef kv::interval<double> itv; | |
struct Func { | |
template <class T> ub::vector<T> operator() (const ub::vector<T>& x) { | |
static T p = kv::constants<T>::pi(); |