Skip to content

Instantly share code, notes, and snippets.

View Shekharrajak's full-sized avatar
📚
Being Geek!

Shekhar Prasad Rajak Shekharrajak

📚
Being Geek!
View GitHub Profile
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
In [ ]: solveset(2*sin(x) - 1<0,x, S.Reals)
Out[ ]:
⎛ π⎞ ⎛5⋅π ⎞
⎜-∞, ─⎟ ∪ ⎜───, ∞⎟
⎝ 6⎠ ⎝ 6 ⎠
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)}
import csv
import cStringIO
import codecs
import glob
import json
import requests
def fetch_jsons():
url = ('https://summerofcode.withgoogle.com/api/program/current/project/'
@Shekharrajak
Shekharrajak / matrix.py
Created April 3, 2016 16:33 — forked from bpgergo/matrix.py
Concurrent matrix multiplication
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
@Shekharrajak
Shekharrajak / hermite.py
Created October 24, 2015 07:24 — forked from cheery/first_fundamental_form.py
Sympy funnies & Cubic hermite
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')
@Shekharrajak
Shekharrajak / User.js
Created July 16, 2015 06:16
For the tutorial on medium.com : passportJS auth
/**
* 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 = {
@Shekharrajak
Shekharrajak / layout.ejs
Created July 16, 2015 06:02
For the tutorial on medium.com : passportJS auth
<!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">
@Shekharrajak
Shekharrajak / routes.js
Created July 16, 2015 05:55
For the tutorial on medium.com : passportJS auth
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) *
@Shekharrajak
Shekharrajak / isAuthenticated.js
Created July 16, 2015 05:53
For the tutorial on medium.com : passportJS auth
module.exports = function(req, res, next) {
if (req.isAuthenticated()) {
return next();
}
else{
return res.redirect('/login');
}
};