Skip to content

Instantly share code, notes, and snippets.

View Ben1980's full-sized avatar

Benjamin Mahr Ben1980

View GitHub Profile
int a = 0
double simpsonIntegral(double a, double b, int n, const std::function<double (double)> &f) {
const double width = (b-a)/n;
double simpson_integral = 0;
for(int step = 0; step < n; step++) {
const double x1 = a + step*width;
const double x2 = a + (step+1)*width;
simpson_integral += (x2-x1)/6.0*(f(x1) + 4.0*f(0.5*(x1+x2)) + f(x2));
}
double trapezoidalIntegral(double a, double b, int n, const std::function<double (double)> &f) {
const double width = (b-a)/n;
double trapezoidal_integral = 0;
for(int step = 0; step < n; step++) {
const double x1 = a + step*width;
const double x2 = a + (step+1)*width;
trapezoidal_integral += 0.5*(x2-x1)*(f(x1) + f(x2));
}
[bmahr@localhost gradleNative]$ ./gradlew tasks
> Task :tasks
------------------------------------------------------------
Tasks runnable from root project
------------------------------------------------------------
Build tasks
-----------
plugins {
id 'cpp-unit-test'
}
unitTest {
dependencies {
implementation project(':greeter')
}
baseName = "greeterTest"
plugins {
id 'cpp-library'
}
library {
linkage = [Linkage.SHARED]
targetMachines = [
machines.windows.x86_64,
machines.macOS.x86_64,
plugins {
id 'cpp-application'
}
application {
dependencies {
implementation project(':greeter')
}
targetMachines = [
.
├── app
│   ├── build.gradle
│   └── src
│   └── main
│   └── cpp
│   └── main.cpp
├── build.gradle
├── gradle
│   └── wrapper
pipeline {
agent any
options {
buildDiscarder(logRotator(numToKeepStr: '10'))
}
parameters {
booleanParam name: 'RUN_TESTS', defaultValue: true, description: 'Run Tests?'
booleanParam name: 'RUN_ANALYSIS', defaultValue: true, description: 'Run Static Code Analysis?'
@Ben1980
Ben1980 / CMakeLists.txt
Created March 17, 2019 20:17 — forked from nocnokneo/CMakeLists.txt
VTK Rendered to an FBO in a Qt Quick 2 Scene Graph
cmake_minimum_required(VERSION 2.8.11)
project(VtkFboInQtQuick)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})