{{ message }}

Instantly share code, notes, and snippets.

📚
Being Geek!

📚
Being Geek!
Created May 16, 2017
View pivot_table_testing_daru.rb
 require 'pivot_table' require 'daru' class Order attr_reader :city, :quarter, :top_sales def initialize args args.each do |k,v| instance_variable_set("@#{k}", v) unless v.nil? end end
Created Sep 4, 2016
View permute_soln.py
 # code from sympy.diophantine for solution in solns_pell: for X_i in [-solution[0], solution[0]]: for Y_i in [-solution[1], solution[1]]: s = P*Matrix([X_i, Y_i]) + Q try: sol.add(tuple([as_int(_) for _ in s])) except ValueError:
Last active Aug 28, 2016
View sympy_sets_reduced_union_rewrite_idea1.py
 # args = list(FiniteSet(*args)) length = len(args) reduced = [[None for x in range(length)] for x in range(length)] # base case reduced[0][0] = [args[0]] # first row for i in range(1, length - 1): new_set = reduced[0][i - 1][0]._union(args[i]) if new_set is not None: reduced[0][i] = [new_set]
Created Aug 14, 2016
logic which is changed to issuperset
View trig_general_union_PR11188.py
 # logic for imageSet union # img1 = ImageSet(Lambda(n, a*n + b), S.Integers) # img2 = ImageSet(Lambda(n, c*n + d), S.Integers) # When a != c and (c + (b - d)) mod a == 0, means (c + (b-d))*n may be multiple of a*n. # After checking it for 3 values, returns img1. # In [1]: Union(ImageSet(Lambda(n, 3*n), S.Integers), ImageSet(Lambda(n, 6*n), S.Integers)) # Out[1]: {3⋅n | n ∊ ℤ} # In [2]: Union(ImageSet(Lambda(n, 3*n ), S.Integers), ImageSet(Lambda(n, 7*n ), S.Integers))
Last active Aug 1, 2016
View gsoc_trig_general_imageset_union_pr_11188.py
 # master branch In [1]: solveset(cos(x) + cos(3*x) + cos(5*x), x, S.Reals) Out[1]: ⎧ π ⎫ ⎧ 3⋅π ⎫ ⎧ 4⋅π ⎫ ⎧ 2⋅π ⎫ ⎧ 5⋅π ⎫ ⎧ π ⎫ ⎧ ⎨2⋅n⋅π + ─ | n ∊ ℤ⎬ ∪ ⎨2⋅n⋅π + ─── | n ∊ ℤ⎬ ∪ ⎨2⋅n⋅π + ─── | n ∊ ℤ⎬ ∪ ⎨2⋅n⋅π + ─── | n ∊ ℤ⎬ ∪ ⎨2⋅n⋅π + ─── | n ∊ ℤ⎬ ∪ ⎨2⋅n⋅π + ─ | n ∊ ℤ⎬ ∪ ⎨2⋅n⋅π + ⎩ 2 ⎭ ⎩ 2 ⎭ ⎩ 3 ⎭ ⎩ 3 ⎭ ⎩ 3 ⎭ ⎩ 3 ⎭ ⎩ 7⋅π ⎫ ⎧ 5⋅π ⎫ ⎧ 11⋅π ⎫ ⎧ π ⎫ ─── | n ∊ ℤ⎬ ∪ ⎨2⋅n⋅π + ─── | n ∊ ℤ⎬ ∪ ⎨2⋅n⋅π + ──── | n ∊ ℤ⎬ ∪ ⎨2⋅n⋅π + ─ | n ∊ ℤ⎬
Created Aug 1, 2016
View Union_imageset_1Aug_2016.py
 def _union(self, other): """ This function should only be used internally. See Set._union for docstring Used within the :class:`Union` class This function club imageset `other` with `self` if there is difference of `pi` or `2*pi` and returns this new imageset otherwise None.
Last active Jul 11, 2016
View put_values_attr_for_imageSet_idea_dropped_11jul2016.py
 # in fancyset/ImageSet class lamda_vars = property(lambda self: self.lamda.variables) def put_values(self, symbol, val=None): """ Returns ImageSet expr value in FiniteSet after substituting the given `values` for `symbol`. Input can be either a single symbol and corresponding value or a dictionary of symbols and values. If symbol(s) are present in
Created Jul 9, 2016
View substitution_not_working_break_func_9jul2016.py
 def substitution(system, symbols, result=[{}], known_symbols=[], exclude=[], all_symbols=None): r""" Solves the `system` using substitution method. A helper function for `nonlinsolve`. This will be called from `nonlinsolve` when any equation(s) is non polynomial equation. Parameters ========== system : list of equations
Created Jul 7, 2016
View nonlinsolve__solve_using_know_values_7jul2016.py
 def _solve_using_known_values(result, solver): """Solves the system using already known solution (result contains the dict ). solver is `solveset_complex` or `solveset_real`. """ # stores imageset . soln_imageset = {} total_solveset_call_inner = 0 total_conditionset_inner = 0
Created Jul 7, 2016
View substitution_nonlinsolve_parts7jul2016.py
 def _extract_main_soln(sol, soln_imageset): """separate the Complements, Intersections, ImageSet lambda expr and it's base_set. """ # if there is union, then need to check # complement, intersection, Imageset # order should not be changed. if isinstance(sol, Complement): # extract solution and complement complements[sym] = sol.args[1]