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
def reduce_imageset(soln): | |
""" | |
Try to reduce number of imageset in the args. | |
It is mostly helper to _solve_trig method defined in | |
solvers/solveset.py. | |
First extract the expression of imageset and | |
sort the negative and positive expression. | |
and using interpolate defined in polys/polyfuncs.py | |
generates a function in `n`, which can return all the |
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
In [ ]: solveset(2*sin(x) - 1<0,x, S.Reals) | |
Out[ ]: | |
⎛ π⎞ ⎛5⋅π ⎞ | |
⎜-∞, ─⎟ ∪ ⎜───, ∞⎟ | |
⎝ 6⎠ ⎝ 6 ⎠ |
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
def nlinsolve_matrix(system, symbols): | |
r""" | |
reference : http://people.math.gatech.edu/~aleykin3/math4803spr13/BOOK/chapter1.pdf | |
page :9 example = 2.2 | |
currently for 2 equations | |
Examples | |
>>> from sympy.solvers.solveset import nlinsolve_matrix | |
>>> nlinsolve_matrix([x*y - 1, 4*x**2 + y**2 - 5],[x,y]) | |
>>> {(-1, -1), (-1/2, -2), (1/2, 2), (1, 1)} |
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 csv | |
import cStringIO | |
import codecs | |
import glob | |
import json | |
import requests | |
def fetch_jsons(): | |
url = ('https://summerofcode.withgoogle.com/api/program/current/project/' |
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 random | |
import multiprocessing | |
from itertools import starmap, izip, repeat, imap | |
from operator import mul | |
def calc_row_of_product_matrix(a_row, b, izip=izip): | |
'''Calculate a row of the product matrix P = A * B | |
Arguments: | |
a_row is af A | |
b is the B matrix |
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 sympy import * | |
# https://www.rose-hulman.edu/~finn/CCLI/Notes/day09.pdf | |
a0, a1, a2, a3, t = symbols('a0 a1 a2 a3 t') | |
polynomial = a0 + a1*t + a2*t**2 + a3*t**3 | |
polynomial_d = diff(polynomial, t) | |
p0, v0, p1, v1 = symbols('p0 v0 p1 v1') |
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
/** | |
* User.js | |
* | |
* @description :: TODO: You might write a short summary of how this model works and what it represents here. | |
* @docs :: http://sailsjs.org/#!documentation/models | |
*/ | |
var bcrypt = require('bcrypt'); | |
module.exports = { |
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
<!DOCTYPE html> | |
<html lang="en" ng-app> | |
<head> | |
<title>PassportJS Auth</title> | |
<!-- Viewport mobile tag for sensible mobile support --> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | |
<!-- Created by shekhar Prasad Rajak follow me on github for more awesome repo : www.github.com/shekharrajak --> | |
<!--STYLES--> | |
<link rel="stylesheet" href="/styles/animate.css"> |
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.exports.routes = { | |
/*************************************************************************** | |
* * | |
* Make the view located at `views/homepage.ejs` (or `views/homepage.jade`, * | |
* etc. depending on your default view engine) your home page. * | |
* * | |
* (Alternatively, remove this and add an `index.html` file in your * | |
* `assets` directory) * |
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.exports = function(req, res, next) { | |
if (req.isAuthenticated()) { | |
return next(); | |
} | |
else{ | |
return res.redirect('/login'); | |
} | |
}; |