Workload points are set here and are used to calculate capacity points for all Offender Managers throughout the Workload Management Tool.
Current Workload Points created by test user on 01/01/2017
Workload points are set here and are used to calculate capacity points for all Offender Managers throughout the Workload Management Tool.
Current Workload Points created by test user on 01/01/2017


{{query}}
{{phone.snippet}}
Total number of phones : {{phones.length}}
Fast just got faster with Nexus S.
The Next, Next Generation tablet.


| EU Ind Prodn MoM (%) | Actuals | |||||
| Release Dt | For Month | Market Expectation | Kshitij Expectation | Previous | Released | Revision |
| 13-Dec-17 | Oct-17 | -0.2 | - | -0.55 | 0.18 | 0.37 |
| 11-Jan-18 | Nov-17 | 0.6 | - | 0.37 | 1.01 | 1.28 |
| 14-Feb-18 | Dec-17 | 0.1 | -0.44 | 1.28 | 0.36 | - |
| 14-Mar-18 | Jan-18 | - | -0.67 | 0.36 | - | - |
| Copyright: Kshitij Consultancy Services |


When writing the "filter" for a JDOQL Query you can make use of some methods on the various Java types. The range of methods included as standard in JDOQL is not as flexible as with the true Java types, but the ones that are available are typically of much use.
| Method | Description |
|---|---|
startsWith(String) |
Returns if the string starts with the passed string |
startsWith(String, int) |
Returns if the string starts with the passed string, after the specified position |
endsWith(String) |
Returns if the string ends with the passed string |
indexOf(String) |
Returns the first position of the passed string |
indexOf(String, int) |
Returns the position of the passed string, after the passed position |
substring(int) |
Returns the substring starting from the passed position |
substring(int, int) |
Returns the substring between the passed positions |
toLowerCase() |
Returns the string in lowercase |
toUpperCase() |
Retuns the string in UPPERCASE |
matches(String pattern) |
Returns whether string matches the passed expression. The pattern argument follows the rules of java.lang.String.matches method. |
trim() |
Retuns the string with leading/trailing spaces trimmed |
length() |
Retuns the length of the string |
charAt(int) |
Returns the character at the specified position of the string |
Here’s an example using a Product class, looking for objects which their abreviation is the beginning of a trade name. The trade name is provided as parameter.
Declarative JDOQL : Query query = pm.newQuery(mydomain.Product.class); query.setFilter(":tradeName.startsWith(this.abbreviation)"); List results = (List)query.execute("Workbook Advanced"); Single-String JDOQL : Query query = pm.newQuery( "SELECT FROM mydomain.Product " + "WHERE :tradeName.startsWith(this.abbreviation)"); List results = (List)query.execute("Workbook Advanced");
Here’s another example, demonstrating the "matches" method. Consult the javadocs for Java regular expressions for the syntax of the matches input.
Declarative JDOQL : Query query = pm.newQuery(mydomain.Product.class); query.setFilter("this.abbreviation.matches(\"a*b\")"); List results = (List)query.execute(); Single-String JDOQL : Query query = pm.newQuery( "SELECT FROM mydomain.Product " + "WHERE this.abbreviation.matches(\"a*b\")"); List results = (List)query.execute();
| Method | Description |
|---|---|
isEmpty() |
Returns whether the collection is empty |
contains(value) |
Returns whether the collection contains the passed element |
size() |
Returns the number of elements in the collection |
Here’s an example demonstrating use of contains(). We have an Inventory class that has a Collection of Product objects, and we want to find the Inventory objects with 2 particular Products in it. Here we make use of a variable (prd to represent the Product being contained
Declarative JDOQL : Query query = pm.newQuery(mydomain.Inventory.class); query.setFilter("products.contains(prd) && (prd.name==\"product 1\" || prd.name==\"product 2\")"); List results = (List)query.execute(); Single-String JDOQL: Query query = pm.newQuery( "SELECT FROM mydomain.Inventory EXCLUDE SUBCLASSES " + "WHERE products.contains(prd) && (prd.name==\"product 1\" || prd.name==\"product 2\")"); List results = (List)query.execute();
| Method | Description |
|---|---|
get(position) |
Returns the element at that position in the List (JDO3.1) |
| Method | Description |
|---|---|
isEmpty() |
Returns whether the map is empty |
containsKey(key) |
Returns whether the map contains the passed key |
containsValue(value) |
Returns whether the map contains the passed value |
get(key) |
Returns the value from the map with the passed key |
size() |
Returns the number of entries in the map |
Here’s an example using a Product class as a value in a Map. Our example represents an organisation that has several Inventories of products. Each Inventory of products is stored using a Map, keyed by the Product name. The query searches for all Inventories that contain a product with the name "product 1".
Declarative JDOQL : Query query = pm.newQuery(mydomain.Inventory.class, "products.containsKey(\"product 1\")"); List results = (List)query.execute(); Single-String JDOQL : Query query = pm.newQuery( "SELECT FROM mydomain.Inventory EXCLUDE SUBCLASSES " + "WHERE products.containsKey(\"product 1\")"); List results = (List)query.execute();
| Method | Description |
|---|---|
getDay() |
Returns the day of the month |
getMonth() |
Returns the month of the year |
getYear() |
Returns the year |
getHour() |
Returns the hour |
getMinute() |
Returns the minute |
getSecond() |
Returns the second |
| Method | Description |
|---|---|
ordinal() |
Returns the ordinal of the enum |
toString() |
Returns the string form of the enum |
| Method | Description |
|---|---|
Math.abs(number) |
Returns the absolute value of the passed number |
Math.sqrt(number) |
Returns the square root of the passed number |
Math.cos(number) |
Returns the cosine of the passed number |
Math.sin(number) |
Returns the sine of the passed number |
Math.tan(number) |
Returns the tangent of the passed number |
JDOHelper.getObjectId(object) |
Returns the object identity of the passed persistent object |
JDOHelper.getVersion(object) |
Returns the version of the passed persistent object |


ECB investigating after Jofra Archer says he was racially insulted
England lost the first Test against New Zealand.
The England and Wales Cricket Board is looking into Jofra Archer’s claim that he was racially insulted while batting against New Zealand in the first Test.
Archer scored a second-innings 30 as England failed to bat out the final day in Mount Maunganui, losing by an innings and 65 runs.
The 24-year-old paceman said on Twitter: “A bit disturbing hearing racial insults today while battling to help save my team.
“The crowd has been amazing this week except for that one guy. The Barmy Army was good as usual also.”


| | |
- calculate_first_step(lattice, step, search_direction, exclusion, dv, dv_total, ref)
- dot(...)
- dot(a, b, out=None)
Dot product of two arrays.
For 2-D arrays it is equivalent to matrix multiplication, and for 1-D
arrays to inner product of vectors (without complex conjugation). For
N dimensions it is a sum product over the last axis of `a` and
the second-to-last of `b`::
dot(a, b)[i,j,k,m] = sum(a[i,j,:] * b[k,:,m])
Parameters
----------
a : array_like
First argument.
b : array_like
Second argument.
out : ndarray, optional
Output argument. This must have the exact kind that would be returned
if it was not used. In particular, it must have the right type, must be
C-contiguous, and its dtype must be the dtype that would be returned
for `dot(a,b)`. This is a performance feature. Therefore, if these
conditions are not met, an exception is raised, instead of attempting
to be flexible.
Returns
-------
output : ndarray
Returns the dot product of `a` and `b`. If `a` and `b` are both
scalars or both 1-D arrays then a scalar is returned; otherwise
an array is returned.
If `out` is given, then it is returned.
Raises
------
ValueError
If the last dimension of `a` is not the same size as
the second-to-last dimension of `b`.
See Also
--------
vdot : Complex-conjugating dot product.
tensordot : Sum products over arbitrary axes.
einsum : Einstein summation convention.
Examples
--------
>>> np.dot(3, 4)
12
Neither argument is complex-conjugated:
>>> np.dot([2j, 3j], [2j, 3j])
(-13+0j)
For 2-D arrays it's the matrix product:
>>> a = [[1, 0], [0, 1]]
>>> b = [[4, 1], [2, 2]]
>>> np.dot(a, b)
array([[4, 1],
[2, 2]])
>>> a = np.arange(3*4*5*6).reshape((3,4,5,6))
>>> b = np.arange(3*4*5*6)[::-1].reshape((5,4,6,3))
>>> np.dot(a, b)[2,3,2,1,2,2]
499128
>>> sum(a[2,3,2,:] * b[1,2,:,2])
499128
- invquad_line_min(lattice, direction, step, tol)
- main()
- minimise_lattice(lattice, mintype, mintol)
- quadratic_line_min(lattice, direction, step, tol)
- secant_line_min(lattice, direction, step, tol)
- sheppards_lbfgs(lattice, tolerance=0.01, max_move=0.2, memory=50, alpha=0.05, scale=3)
- sqrt(...)
- sqrt(x)
Return the square root of x.
|


{% extends "base/base.html" %} {% block title %}Inventory Added{% endblock %} {% block body %}
New item added to your inventory.


{% extends "base/base.html" %} {% load bootstrap3 %} {% block content %}
This web application allows easy selection of targets for later annotation in a parallel corpus. View instructions » Sign in »


var->bar_comments
Crowd: var->crowd
Address: var->address
Date added: var->dateadded
Phone Number: var->phonenumber
Bar Open: var->time_open - var->time_closed


"""Base class for all the objects in SymPy"""
from __future__ import print_function, division
from collections import Mapping
from .assumptions import BasicMeta, ManagedProperties
from .cache import cacheit
from .sympify import _sympify, sympify, SympifyError
from .compatibility import (iterable, Iterator, ordered,
string_types, with_metaclass, zip_longest, range)
from .singleton import S
from inspect import getmro
[docs]class Basic(with_metaclass(ManagedProperties)):
"""
Base class for all objects in SymPy.
Conventions:
1) Always use ``.args``, when accessing parameters of some instance:
>>> from sympy import cot
>>> from sympy.abc import x, y
>>> cot(x).args
(x,)
>>> cot(x).args[0]
x
>>> (x*y).args
(x, y)
>>> (x*y).args[1]
y
2) Never use internal methods or variables (the ones prefixed with ``_``):
>>> cot(x)._args # do not use this, use cot(x).args instead
(x,)
"""
__slots__ = ['_mhash', # hash value
'_args', # arguments
'_assumptions'
]
# To be overridden with True in the appropriate subclasses
is_number = False
is_Atom = False
is_Symbol = False
is_Dummy = False
is_Wild = False
is_Function = False
is_Add = False
is_Mul = False
is_Pow = False
is_Number = False
is_Float = False
is_Rational = False
is_Integer = False
is_NumberSymbol = False
is_Order = False
is_Derivative = False
is_Piecewise = False
is_Poly = False
is_AlgebraicNumber = False
is_Relational = False
is_Equality = False
is_Boolean = False
is_Not = False
is_Matrix = False
is_Vector = False
is_Point = False
def __new__(cls, *args):
obj = object.__new__(cls)
obj._assumptions = cls.default_assumptions
obj._mhash = None # will be set by __hash__ method.
obj._args = args # all items in args must be Basic objects
return obj
def copy(self):
return self.func(*self.args)
def __reduce_ex__(self, proto):
""" Pickling support."""
return type(self), self.__getnewargs__(), self.__getstate__()
def __getnewargs__(self):
return self.args
def __getstate__(self):
return {}
def __setstate__(self, state):
for k, v in state.items():
setattr(self, k, v)
def __hash__(self):
# hash cannot be cached using cache_it because infinite recurrence
# occurs as hash is needed for setting cache dictionary keys
h = self._mhash
if h is None:
h = hash((type(self).__name__,) + self._hashable_content())
self._mhash = h
return h
def _hashable_content(self):
"""Return a tuple of information about self that can be used to
compute the hash. If a class defines additional attributes,
like ``name`` in Symbol, then this method should be updated
accordingly to return such relevant attributes.
Defining more than _hashable_content is necessary if __eq__ has
been defined by a class. See note about this in Basic.__eq__."""
return self._args
@property
def assumptions0(self):
"""
Return object `type` assumptions.
For example:
Symbol('x', real=True)
Symbol('x', integer=True)
are different objects. In other words, besides Python type (Symbol in
this case), the initial assumptions are also forming their typeinfo.
Examples
========
>>> from sympy import Symbol
>>> from sympy.abc import x
>>> x.assumptions0
{'commutative': True}
>>> x = Symbol("x", positive=True)
>>> x.assumptions0
{'commutative': True, 'complex': True, 'hermitian': True,
'imaginary': False, 'negative': False, 'nonnegative': True,
'nonpositive': False, 'nonzero': True, 'positive': True, 'real': True,
'zero': False}
"""
return {}
[docs] def compare(self, other):
"""
Return -1, 0, 1 if the object is smaller, equal, or greater than other.
Not in the mathematical sense. If the object is of a different type
from the "other" then their classes are ordered according to
the sorted_classes list.
Examples
========
>>> from sympy.abc import x, y
>>> x.compare(y)
-1
>>> x.compare(x)
0
>>> y.compare(x)
1
"""
# all redefinitions of __cmp__ method should start with the
# following lines:
if self is other:
return 0
n1 = self.__class__
n2 = other.__class__
c = (n1 > n2) - (n1 < n2)
if c:
return c
#
st = self._hashable_content()
ot = other._hashable_content()
c = (len(st) > len(ot)) - (len(st) < len(ot))
if c:
return c
for l, r in zip(st, ot):
l = Basic(*l) if isinstance(l, frozenset) else l
r = Basic(*r) if isinstance(r, frozenset) else r
if isinstance(l, Basic):
c = l.compare(r)
else:
c = (l > r) - (l < r)
if c:
return c
return 0
@staticmethod
def _compare_pretty(a, b):
from sympy.series.order import Order
if isinstance(a, Order) and not isinstance(b, Order):
return 1
if not isinstance(a, Order) and isinstance(b, Order):
return -1
if a.is_Rational and b.is_Rational:
l = a.p * b.q
r = b.p * a.q
return (l > r) - (l < r)
else:
from sympy.core.symbol import Wild
p1, p2, p3 = Wild("p1"), Wild("p2"), Wild("p3")
r_a = a.match(p1 * p2**p3)
if r_a and p3 in r_a:
a3 = r_a[p3]
r_b = b.match(p1 * p2**p3)
if r_b and p3 in r_b:
b3 = r_b[p3]
c = Basic.compare(a3, b3)
if c != 0:
return c
return Basic.compare(a, b)
@classmethod
[docs] def fromiter(cls, args, **assumptions):
"""
Create a new object from an iterable.
This is a convenience function that allows one to create objects from
any iterable, without having to convert to a list or tuple first.
Examples
========
>>> from sympy import Tuple
>>> Tuple.fromiter(i for i in range(5))
(0, 1, 2, 3, 4)
"""
return cls(*tuple(args), **assumptions)
@classmethod
[docs] def class_key(cls):
"""Nice order of classes. """
return 5, 0, cls.__name__
@cacheit
[docs] def sort_key(self, order=None):
"""
Return a sort key.
Examples
========
>>> from sympy.core import S, I
>>> sorted([S(1)/2, I, -I], key=lambda x: x.sort_key())
[1/2, -I, I]
>>> S("[x, 1/x, 1/x**2, x**2, x**(1/2), x**(1/4), x**(3/2)]")
[x, 1/x, x**(-2), x**2, sqrt(x), x**(1/4), x**(3/2)]
>>> sorted(_, key=lambda x: x.sort_key())
[x**(-2), 1/x, x**(1/4), sqrt(x), x, x**(3/2), x**2]
"""
# XXX: remove this when issue 5169 is fixed
def inner_key(arg):
if isinstance(arg, Basic):
return arg.sort_key(order)
else:
return arg
args = self._sorted_args
args = len(args), tuple([inner_key(arg) for arg in args])
return self.class_key(), args, S.One.sort_key(), S.One
def __eq__(self, other):
"""Return a boolean indicating whether a == b on the basis of
their symbolic trees.
This is the same as a.compare(b) == 0 but faster.
Notes
=====
If a class that overrides __eq__() needs to retain the
implementation of __hash__() from a parent class, the
interpreter must be told this explicitly by setting __hash__ =
<ParentClass>.__hash__. Otherwise the inheritance of __hash__()
will be blocked, just as if __hash__ had been explicitly set to
None.
References
==========
from http://docs.python.org/dev/reference/datamodel.html#object.__hash__
"""
from sympy import Pow
if self is other:
return True
from .function import AppliedUndef, UndefinedFunction as UndefFunc
if isinstance(self, UndefFunc) and isinstance(other, UndefFunc):
if self.class_key() == other.class_key():
return True
else:
return False
if type(self) is not type(other):
# issue 6100 a**1.0 == a like a**2.0 == a**2
if isinstance(self, Pow) and self.exp == 1:
return self.base == other
if isinstance(other, Pow) and other.exp == 1:
return self == other.base
try:
other = _sympify(other)
except SympifyError:
return False # sympy != other
if isinstance(self, AppliedUndef) and isinstance(other,
AppliedUndef):
if self.class_key() != other.class_key():
return False
elif type(self) is not type(other):
return False
return self._hashable_content() == other._hashable_content()
def __ne__(self, other):
"""a != b -> Compare two symbolic trees and see whether they are different
this is the same as:
a.compare(b) != 0
but faster
"""
return not self.__eq__(other)
[docs] def dummy_eq(self, other, symbol=None):
"""
Compare two expressions and handle dummy symbols.
Examples
========
>>> from sympy import Dummy
>>> from sympy.abc import x, y
>>> u = Dummy('u')
>>> (u**2 + 1).dummy_eq(x**2 + 1)
True
>>> (u**2 + 1) == (x**2 + 1)
False
>>> (u**2 + y).dummy_eq(x**2 + y, x)
True
>>> (u**2 + y).dummy_eq(x**2 + y, y)
False
"""
dummy_symbols = [s for s in self.free_symbols if s.is_Dummy]
if not dummy_symbols:
return self == other
elif len(dummy_symbols) == 1:
dummy = dummy_symbols.pop()
else:
raise ValueError(
"only one dummy symbol allowed on the left-hand side")
if symbol is None:
symbols = other.free_symbols
if not symbols:
return self == other
elif len(symbols) == 1:
symbol = symbols.pop()
else:
raise ValueError("specify a symbol in which expressions should be compared")
tmp = dummy.__class__()
return self.subs(dummy, tmp) == other.subs(symbol, tmp)
# Note, we always use the default ordering (lex) in __str__ and __repr__,
# regardless of the global setting. See issue 5487.
def __repr__(self):
from sympy.printing import sstr
return sstr(self, order=None)
def __str__(self):
from sympy.printing import sstr
return sstr(self, order=None)
[docs] def atoms(self, *types):
"""Returns the atoms that form the current object.
By default, only objects that are truly atomic and can't
be divided into smaller pieces are returned: symbols, numbers,
and number symbols like I and pi. It is possible to request
atoms of any type, however, as demonstrated below.
Examples
========
>>> from sympy import I, pi, sin
>>> from sympy.abc import x, y
>>> (1 + x + 2*sin(y + I*pi)).atoms()
set([1, 2, I, pi, x, y])
If one or more types are given, the results will contain only
those types of atoms.
Examples
========
>>> from sympy import Number, NumberSymbol, Symbol
>>> (1 + x + 2*sin(y + I*pi)).atoms(Symbol)
set([x, y])
>>> (1 + x + 2*sin(y + I*pi)).atoms(Number)
set([1, 2])
>>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol)
set([1, 2, pi])
>>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol, I)
set([1, 2, I, pi])
Note that I (imaginary unit) and zoo (complex infinity) are special
types of number symbols and are not part of the NumberSymbol class.
The type can be given implicitly, too:
>>> (1 + x + 2*sin(y + I*pi)).atoms(x) # x is a Symbol
set([x, y])
Be careful to check your assumptions when using the implicit option
since ``S(1).is_Integer = True`` but ``type(S(1))`` is ``One``, a special type
of sympy atom, while ``type(S(2))`` is type ``Integer`` and will find all
integers in an expression:
>>> from sympy import S
>>> (1 + x + 2*sin(y + I*pi)).atoms(S(1))
set([1])
>>> (1 + x + 2*sin(y + I*pi)).atoms(S(2))
set([1, 2])
Finally, arguments to atoms() can select more than atomic atoms: any
sympy type (loaded in core/__init__.py) can be listed as an argument
and those types of "atoms" as found in scanning the arguments of the
expression recursively:
>>> from sympy import Function, Mul
>>> from sympy.core.function import AppliedUndef
>>> f = Function('f')
>>> (1 + f(x) + 2*sin(y + I*pi)).atoms(Function)
set([f(x), sin(y + I*pi)])
>>> (1 + f(x) + 2*sin(y + I*pi)).atoms(AppliedUndef)
set([f(x)])
>>> (1 + x + 2*sin(y + I*pi)).atoms(Mul)
set([I*pi, 2*sin(y + I*pi)])
"""
if types:
types = tuple(
[t if isinstance(t, type) else type(t) for t in types])
else:
types = (Atom,)
result = set()
for expr in preorder_traversal(self):
if isinstance(expr, types):
result.add(expr)
return result
@property
def free_symbols(self):
"""Return from the atoms of self those which are free symbols.
For most expressions, all symbols are free symbols. For some classes
this is not true. e.g. Integrals use Symbols for the dummy variables
which are bound variables, so Integral has a method to return all
symbols except those. Derivative keeps track of symbols with respect
to which it will perform a derivative; those are
bound variables, too, so it has its own free_symbols method.
Any other method that uses bound variables should implement a
free_symbols method."""
return set().union(*[a.free_symbols for a in self.args])
@property
def canonical_variables(self):
"""Return a dictionary mapping any variable defined in
``self.variables`` as underscore-suffixed numbers
corresponding to their position in ``self.variables``. Enough
underscores are added to ensure that there will be no clash with
existing free symbols.
Examples
========
>>> from sympy import Lambda
>>> from sympy.abc import x
>>> Lambda(x, 2*x).canonical_variables
{x: 0_}
"""
from sympy import Symbol
if not hasattr(self, 'variables'):
return {}
u = "_"
while any(s.name.endswith(u) for s in self.free_symbols):
u += "_"
name = '%%i%s' % u
V = self.variables
return dict(list(zip(V, [Symbol(name % i, **v.assumptions0)
for i, v in enumerate(V)])))
[docs] def rcall(self, *args):
"""Apply on the argument recursively through the expression tree.
This method is used to simulate a common abuse of notation for
operators. For instance in SymPy the the following will not work:
``(x+Lambda(y, 2*y))(z) == x+2*z``,
however you can use
>>> from sympy import Lambda
>>> from sympy.abc import x, y, z
>>> (x + Lambda(y, 2*y)).rcall(z)
x + 2*z
"""
return Basic._recursive_call(self, args)
@staticmethod
def _recursive_call(expr_to_call, on_args):
from sympy import Symbol
def the_call_method_is_overridden(expr):
for cls in getmro(type(expr)):
if '__call__' in cls.__dict__:
return cls != Basic
if callable(expr_to_call) and the_call_method_is_overridden(expr_to_call):
if isinstance(expr_to_call, Symbol): # XXX When you call a Symbol it is
return expr_to_call # transformed into an UndefFunction
else:
return expr_to_call(*on_args)
elif expr_to_call.args:
args = [Basic._recursive_call(
sub, on_args) for sub in expr_to_call.args]
return type(expr_to_call)(*args)
else:
return expr_to_call
def is_hypergeometric(self, k):
from sympy.simplify import hypersimp
return hypersimp(self, k) is not None
@property
def is_comparable(self):
"""Return True if self can be computed to a real number
(or already is a real number) with precision, else False.
Examples
========
>>> from sympy import exp_polar, pi, I
>>> (I*exp_polar(I*pi/2)).is_comparable
True
>>> (I*exp_polar(I*pi*2)).is_comparable
False
A False result does not mean that `self` cannot be rewritten
into a form that would be comparable. For example, the
difference computed below is zero but without simplification
it does not evaluate to a zero with precision:
>>> e = 2**pi*(1 + 2**pi)
>>> dif = e - e.expand()
>>> dif.is_comparable
False
>>> dif.n(2)._prec
1
"""
is_real = self.is_real
if is_real is False:
return False
is_number = self.is_number
if is_number is False:
return False
n, i = [p.evalf(2) if not p.is_Number else p
for p in self.as_real_imag()]
if not i.is_Number or not n.is_Number:
return False
if i:
# if _prec = 1 we can't decide and if not,
# the answer is False because numbers with
# imaginary parts can't be compared
# so return False
return False
else:
return n._prec != 1
@property
def func(self):
"""
The top-level function in an expression.
The following should hold for all objects::
>> x == x.func(*x.args)
Examples
========
>>> from sympy.abc import x
>>> a = 2*x
>>> a.func
<class 'sympy.core.mul.Mul'>
>>> a.args
(2, x)
>>> a.func(*a.args)
2*x
>>> a == a.func(*a.args)
True
"""
return self.__class__
@property
def args(self):
"""Returns a tuple of arguments of 'self'.
Examples
========
>>> from sympy import cot
>>> from sympy.abc import x, y
>>> cot(x).args
(x,)
>>> cot(x).args[0]
x
>>> (x*y).args
(x, y)
>>> (x*y).args[1]
y
Notes
=====
Never use self._args, always use self.args.
Only use _args in __new__ when creating a new function.
Don't override .args() from Basic (so that it's easy to
change the interface in the future if needed).
"""
return self._args
@property
def _sorted_args(self):
"""
The same as ``args``. Derived classes which don't fix an
order on their arguments should override this method to
produce the sorted representation.
"""
return self.args
[docs] def as_poly(self, *gens, **args):
"""Converts ``self`` to a polynomial or returns ``None``.
>>> from sympy import sin
>>> from sympy.abc import x, y
>>> print((x**2 + x*y).as_poly())
Poly(x**2 + x*y, x, y, domain='ZZ')
>>> print((x**2 + x*y).as_poly(x, y))
Poly(x**2 + x*y, x, y, domain='ZZ')
>>> print((x**2 + sin(y)).as_poly(x, y))
None
"""
from sympy.polys import Poly, PolynomialError
try:
poly = Poly(self, *gens, **args)
if not poly.is_Poly:
return None
else:
return poly
except PolynomialError:
return None
[docs] def as_content_primitive(self, radical=False, clear=True):
"""A stub to allow Basic args (like Tuple) to be skipped when computing
the content and primitive components of an expression.
See docstring of Expr.as_content_primitive
"""
return S.One, self
[docs] def subs(self, *args, **kwargs):
"""
Substitutes old for new in an expression after sympifying args.
`args` is either:
- two arguments, e.g. foo.subs(old, new)
- one iterable argument, e.g. foo.subs(iterable). The iterable may be
o an iterable container with (old, new) pairs. In this case the
replacements are processed in the order given with successive
patterns possibly affecting replacements already made.
o a dict or set whose key/value items correspond to old/new pairs.
In this case the old/new pairs will be sorted by op count and in
case of a tie, by number of args and the default_sort_key. The
resulting sorted list is then processed as an iterable container
(see previous).
If the keyword ``simultaneous`` is True, the subexpressions will not be
evaluated until all the substitutions have been made.
Examples
========
>>> from sympy import pi, exp, limit, oo
>>> from sympy.abc import x, y
>>> (1 + x*y).subs(x, pi)
pi*y + 1
>>> (1 + x*y).subs({x:pi, y:2})
1 + 2*pi
>>> (1 + x*y).subs([(x, pi), (y, 2)])
1 + 2*pi
>>> reps = [(y, x**2), (x, 2)]
>>> (x + y).subs(reps)
6
>>> (x + y).subs(reversed(reps))
x**2 + 2
>>> (x**2 + x**4).subs(x**2, y)
y**2 + y
To replace only the x**2 but not the x**4, use xreplace:
>>> (x**2 + x**4).xreplace({x**2: y})
x**4 + y
To delay evaluation until all substitutions have been made,
set the keyword ``simultaneous`` to True:
>>> (x/y).subs([(x, 0), (y, 0)])
0
>>> (x/y).subs([(x, 0), (y, 0)], simultaneous=True)
nan
This has the added feature of not allowing subsequent substitutions
to affect those already made:
>>> ((x + y)/y).subs({x + y: y, y: x + y})
1
>>> ((x + y)/y).subs({x + y: y, y: x + y}, simultaneous=True)
y/(x + y)
In order to obtain a canonical result, unordered iterables are
sorted by count_op length, number of arguments and by the
default_sort_key to break any ties. All other iterables are left
unsorted.
>>> from sympy import sqrt, sin, cos
>>> from sympy.abc import a, b, c, d, e
>>> A = (sqrt(sin(2*x)), a)
>>> B = (sin(2*x), b)
>>> C = (cos(2*x), c)
>>> D = (x, d)
>>> E = (exp(x), e)
>>> expr = sqrt(sin(2*x))*sin(exp(x)*x)*cos(2*x) + sin(2*x)
>>> expr.subs(dict([A, B, C, D, E]))
a*c*sin(d*e) + b
The resulting expression represents a literal replacement of the
old arguments with the new arguments. This may not reflect the
limiting behavior of the expression:
>>> (x**3 - 3*x).subs({x: oo})
nan
>>> limit(x**3 - 3*x, x, oo)
oo
If the substitution will be followed by numerical
evaluation, it is better to pass the substitution to
evalf as
>>> (1/x).evalf(subs={x: 3.0}, n=21)
0.333333333333333333333
rather than
>>> (1/x).subs({x: 3.0}).evalf(21)
0.333333333333333314830
as the former will ensure that the desired level of precision is
obtained.
See Also
========
replace: replacement capable of doing wildcard-like matching,
parsing of match, and conditional replacements
xreplace: exact node replacement in expr tree; also capable of
using matching rules
evalf: calculates the given formula to a desired level of precision
"""
from sympy.core.containers import Dict
from sympy.utilities import default_sort_key
from sympy import Dummy, Symbol
unordered = False
if len(args) == 1:
sequence = args[0]
if isinstance(sequence, set):
unordered = True
elif isinstance(sequence, (Dict, Mapping)):
unordered = True
sequence = sequence.items()
elif not iterable(sequence):
from sympy.utilities.misc import filldedent
raise ValueError(filldedent("""
When a single argument is passed to subs
it should be a dictionary of old: new pairs or an iterable
of (old, new) tuples."""))
elif len(args) == 2:
sequence = [args]
else:
raise ValueError("subs accepts either 1 or 2 arguments")
sequence = list(sequence)
for i in range(len(sequence)):
s = list(sequence[i])
for j, si in enumerate(s):
try:
si = sympify(si, strict=True)
except SympifyError:
if type(si) is str:
si = Symbol(si)
else:
# if it can't be sympified, skip it
sequence[i] = None
break
s[j] = si
else:
sequence[i] = None if _aresame(*s) else tuple(s)
sequence = list(filter(None, sequence))
if unordered:
sequence = dict(sequence)
if not all(k.is_Atom for k in sequence):
d = {}
for o, n in sequence.items():
try:
ops = o.count_ops(), len(o.args)
except TypeError:
ops = (0, 0)
d.setdefault(ops, []).append((o, n))
newseq = []
for k in sorted(d.keys(), reverse=True):
newseq.extend(
sorted([v[0] for v in d[k]], key=default_sort_key))
sequence = [(k, sequence[k]) for k in newseq]
del newseq, d
else:
sequence = sorted([(k, v) for (k, v) in sequence.items()],
key=default_sort_key)
if kwargs.pop('simultaneous', False): # XXX should this be the default for dict subs?
reps = {}
rv = self
kwargs['hack2'] = True
m = Dummy()
for old, new in sequence:
d = Dummy(commutative=new.is_commutative)
# using d*m so Subs will be used on dummy variables
# in things like Derivative(f(x, y), x) in which x
# is both free and bound
rv = rv._subs(old, d*m, **kwargs)
if not isinstance(rv, Basic):
break
reps[d] = new
reps[m] = S.One # get rid of m
return rv.xreplace(reps)
else:
rv = self
for old, new in sequence:
rv = rv._subs(old, new, **kwargs)
if not isinstance(rv, Basic):
break
return rv
@cacheit
def _subs(self, old, new, **hints):
"""Substitutes an expression old -> new.
If self is not equal to old then _eval_subs is called.
If _eval_subs doesn't want to make any special replacement
then a None is received which indicates that the fallback
should be applied wherein a search for replacements is made
amongst the arguments of self.
>>> from sympy import Add
>>> from sympy.abc import x, y, z
Examples
========
Add's _eval_subs knows how to target x + y in the following
so it makes the change:
>>> (x + y + z).subs(x + y, 1)
z + 1
Add's _eval_subs doesn't need to know how to find x + y in
the following:
>>> Add._eval_subs(z*(x + y) + 3, x + y, 1) is None
True
The returned None will cause the fallback routine to traverse the args and
pass the z*(x + y) arg to Mul where the change will take place and the
substitution will succeed:
>>> (z*(x + y) + 3).subs(x + y, 1)
z + 3
** Developers Notes **
An _eval_subs routine for a class should be written if:
1) any arguments are not instances of Basic (e.g. bool, tuple);
2) some arguments should not be targeted (as in integration
variables);
3) if there is something other than a literal replacement
that should be attempted (as in Piecewise where the condition
may be updated without doing a replacement).
If it is overridden, here are some special cases that might arise:
1) If it turns out that no special change was made and all
the original sub-arguments should be checked for
replacements then None should be returned.
2) If it is necessary to do substitutions on a portion of
the expression then _subs should be called. _subs will
handle the case of any sub-expression being equal to old
(which usually would not be the case) while its fallback
will handle the recursion into the sub-arguments. For
example, after Add's _eval_subs removes some matching terms
it must process the remaining terms so it calls _subs
on each of the un-matched terms and then adds them
onto the terms previously obtained.
3) If the initial expression should remain unchanged then
the original expression should be returned. (Whenever an
expression is returned, modified or not, no further
substitution of old -> new is attempted.) Sum's _eval_subs
routine uses this strategy when a substitution is attempted
on any of its summation variables.
"""
def fallback(self, old, new):
"""
Try to replace old with new in any of self's arguments.
"""
hit = False
args = list(self.args)
for i, arg in enumerate(args):
if not hasattr(arg, '_eval_subs'):
continue
arg = arg._subs(old, new, **hints)
if not _aresame(arg, args[i]):
hit = True
args[i] = arg
if hit:
rv = self.func(*args)
hack2 = hints.get('hack2', False)
if hack2 and self.is_Mul and not rv.is_Mul: # 2-arg hack
coeff = S.One
nonnumber = []
for i in args:
if i.is_Number:
coeff *= i
else:
nonnumber.append(i)
nonnumber = self.func(*nonnumber)
if coeff is S.One:
return nonnumber
else:
return self.func(coeff, nonnumber, evaluate=False)
return rv
return self
if _aresame(self, old):
return new
rv = self._eval_subs(old, new)
if rv is None:
rv = fallback(self, old, new)
return rv
def _eval_subs(self, old, new):
"""Override this stub if you want to do anything more than
attempt a replacement of old with new in the arguments of self.
See also: _subs
"""
return None
[docs] def xreplace(self, rule):
"""
Replace occurrences of objects within the expression.
Parameters
==========
rule : dict-like
Expresses a replacement rule
Returns
=======
xreplace : the result of the replacement
Examples
========
>>> from sympy import symbols, pi, exp
>>> x, y, z = symbols('x y z')
>>> (1 + x*y).xreplace({x: pi})
pi*y + 1
>>> (1 + x*y).xreplace({x: pi, y: 2})
1 + 2*pi
Replacements occur only if an entire node in the expression tree is
matched:
>>> (x*y + z).xreplace({x*y: pi})
z + pi
>>> (x*y*z).xreplace({x*y: pi})
x*y*z
>>> (2*x).xreplace({2*x: y, x: z})
y
>>> (2*2*x).xreplace({2*x: y, x: z})
4*z
>>> (x + y + 2).xreplace({x + y: 2})
x + y + 2
>>> (x + 2 + exp(x + 2)).xreplace({x + 2: y})
x + exp(y) + 2
xreplace doesn't differentiate between free and bound symbols. In the
following, subs(x, y) would not change x since it is a bound symbol,
but xreplace does:
>>> from sympy import Integral
>>> Integral(x, (x, 1, 2*x)).xreplace({x: y})
Integral(y, (y, 1, 2*y))
Trying to replace x with an expression raises an error:
>>> Integral(x, (x, 1, 2*x)).xreplace({x: 2*y}) # doctest: +SKIP
ValueError: Invalid limits given: ((2*y, 1, 4*y),)
See Also
========
replace: replacement capable of doing wildcard-like matching,
parsing of match, and conditional replacements
subs: substitution of subexpressions as defined by the objects
themselves.
"""
value, _ = self._xreplace(rule)
return value
def _xreplace(self, rule):
"""
Helper for xreplace. Tracks whether a replacement actually occurred.
"""
if self in rule:
return rule[self], True
elif rule:
args = []
changed = False
for a in self.args:
try:
a_xr = a._xreplace(rule)
args.append(a_xr[0])
changed |= a_xr[1]
except AttributeError:
args.append(a)
args = tuple(args)
if changed:
return self.func(*args), True
return self, False
@cacheit
[docs] def has(self, *patterns):
"""
Test whether any subexpression matches any of the patterns.
Examples
========
>>> from sympy import sin
>>> from sympy.abc import x, y, z
>>> (x**2 + sin(x*y)).has(z)
False
>>> (x**2 + sin(x*y)).has(x, y, z)
True
>>> x.has(x)
True
Note that ``expr.has(*patterns)`` is exactly equivalent to
``any(expr.has(p) for p in patterns)``. In particular, ``False`` is
returned when the list of patterns is empty.
>>> x.has()
False
"""
return any(self._has(pattern) for pattern in patterns)
def _has(self, pattern):
"""Helper for .has()"""
from sympy.core.function import UndefinedFunction, Function
if isinstance(pattern, UndefinedFunction):
return any(f.func == pattern or f == pattern
for f in self.atoms(Function, UndefinedFunction))
pattern = sympify(pattern)
if isinstance(pattern, BasicMeta):
return any(isinstance(arg, pattern)
for arg in preorder_traversal(self))
try:
match = pattern._has_matcher()
return any(match(arg) for arg in preorder_traversal(self))
except AttributeError:
return any(arg == pattern for arg in preorder_traversal(self))
def _has_matcher(self):
"""Helper for .has()"""
return self.__eq__
[docs] def replace(self, query, value, map=False, simultaneous=True, exact=False):
"""
Replace matching subexpressions of ``self`` with ``value``.
If ``map = True`` then also return the mapping {old: new} where ``old``
was a sub-expression found with query and ``new`` is the replacement
value for it. If the expression itself doesn't match the query, then
the returned value will be ``self.xreplace(map)`` otherwise it should
be ``self.subs(ordered(map.items()))``.
Traverses an expression tree and performs replacement of matching
subexpressions from the bottom to the top of the tree. The default
approach is to do the replacement in a simultaneous fashion so
changes made are targeted only once. If this is not desired or causes
problems, ``simultaneous`` can be set to False. In addition, if an
expression containing more than one Wild symbol is being used to match
subexpressions and the ``exact`` flag is True, then the match will only
succeed if non-zero values are received for each Wild that appears in
the match pattern.
The list of possible combinations of queries and replacement values
is listed below:
Examples
========
Initial setup
>>> from sympy import log, sin, cos, tan, Wild, Mul, Add
>>> from sympy.abc import x, y
>>> f = log(sin(x)) + tan(sin(x**2))
1.1. type -> type
obj.replace(type, newtype)
When object of type ``type`` is found, replace it with the
result of passing its argument(s) to ``newtype``.
>>> f.replace(sin, cos)
log(cos(x)) + tan(cos(x**2))
>>> sin(x).replace(sin, cos, map=True)
(cos(x), {sin(x): cos(x)})
>>> (x*y).replace(Mul, Add)
x + y
1.2. type -> func
obj.replace(type, func)
When object of type ``type`` is found, apply ``func`` to its
argument(s). ``func`` must be written to handle the number
of arguments of ``type``.
>>> f.replace(sin, lambda arg: sin(2*arg))
log(sin(2*x)) + tan(sin(2*x**2))
>>> (x*y).replace(Mul, lambda *args: sin(2*Mul(*args)))
sin(2*x*y)
2.1. pattern -> expr
obj.replace(pattern(wild), expr(wild))
Replace subexpressions matching ``pattern`` with the expression
written in terms of the Wild symbols in ``pattern``.
>>> a = Wild('a')
>>> f.replace(sin(a), tan(a))
log(tan(x)) + tan(tan(x**2))
>>> f.replace(sin(a), tan(a/2))
log(tan(x/2)) + tan(tan(x**2/2))
>>> f.replace(sin(a), a)
log(x) + tan(x**2)
>>> (x*y).replace(a*x, a)
y
When the default value of False is used with patterns that have
more than one Wild symbol, non-intuitive results may be obtained:
>>> b = Wild('b')
>>> (2*x).replace(a*x + b, b - a)
2/x
For this reason, the ``exact`` option can be used to make the
replacement only when the match gives non-zero values for all
Wild symbols:
>>> (2*x + y).replace(a*x + b, b - a, exact=True)
y - 2
>>> (2*x).replace(a*x + b, b - a, exact=True)
2*x
2.2. pattern -> func
obj.replace(pattern(wild), lambda wild: expr(wild))
All behavior is the same as in 2.1 but now a function in terms of
pattern variables is used rather than an expression:
>>> f.replace(sin(a), lambda a: sin(2*a))
log(sin(2*x)) + tan(sin(2*x**2))
3.1. func -> func
obj.replace(filter, func)
Replace subexpression ``e`` with ``func(e)`` if ``filter(e)``
is True.
>>> g = 2*sin(x**3)
>>> g.replace(lambda expr: expr.is_Number, lambda expr: expr**2)
4*sin(x**9)
The expression itself is also targeted by the query but is done in
such a fashion that changes are not made twice.
>>> e = x*(x*y + 1)
>>> e.replace(lambda x: x.is_Mul, lambda x: 2*x)
2*x*(2*x*y + 1)
See Also
========
subs: substitution of subexpressions as defined by the objects
themselves.
xreplace: exact node replacement in expr tree; also capable of
using matching rules
"""
from sympy.core.symbol import Dummy
from sympy.simplify.simplify import bottom_up
try:
query = sympify(query)
except SympifyError:
pass
try:
value = sympify(value)
except SympifyError:
pass
if isinstance(query, type):
_query = lambda expr: isinstance(expr, query)
if isinstance(value, type):
_value = lambda expr, result: value(*expr.args)
elif callable(value):
_value = lambda expr, result: value(*expr.args)
else:
raise TypeError(
"given a type, replace() expects another "
"type or a callable")
elif isinstance(query, Basic):
_query = lambda expr: expr.match(query)
# XXX remove the exact flag and make multi-symbol
# patterns use exact=True semantics; to do this the query must
# be tested to find out how many Wild symbols are present.
# See https://groups.google.com/forum/
# ?fromgroups=#!topic/sympy/zPzo5FtRiqI
# for a method of inspecting a function to know how many
# parameters it has.
if isinstance(value, Basic):
if exact:
_value = lambda expr, result: (value.subs(result)
if all(val for val in result.values()) else expr)
else:
_value = lambda expr, result: value.subs(result)
elif callable(value):
# match dictionary keys get the trailing underscore stripped
# from them and are then passed as keywords to the callable;
# if ``exact`` is True, only accept match if there are no null
# values amongst those matched.
if exact:
_value = lambda expr, result: (value(**dict([(
str(key)[:-1], val) for key, val in result.items()]))
if all(val for val in result.values()) else expr)
else:
_value = lambda expr, result: value(**dict([(
str(key)[:-1], val) for key, val in result.items()]))
else:
raise TypeError(
"given an expression, replace() expects "
"another expression or a callable")
elif callable(query):
_query = query
if callable(value):
_value = lambda expr, result: value(expr)
else:
raise TypeError(
"given a callable, replace() expects "
"another callable")
else:
raise TypeError(
"first argument to replace() must be a "
"type, an expression or a callable")
mapping = {} # changes that took place
mask = [] # the dummies that were used as change placeholders
def rec_replace(expr):
result = _query(expr)
if result or result == {}:
new = _value(expr, result)
if new is not None and new != expr:
mapping[expr] = new
if simultaneous:
# don't let this expression be changed during rebuilding
com = getattr(new, 'is_commutative', True)
if com is None:
com = True
d = Dummy(commutative=com)
mask.append((d, new))
expr = d
else:
expr = new
return expr
rv = bottom_up(self, rec_replace, atoms=True)
# restore original expressions for Dummy symbols
if simultaneous:
mask = list(reversed(mask))
for o, n in mask:
r = {o: n}
rv = rv.xreplace(r)
if not map:
return rv
else:
if simultaneous:
# restore subexpressions in mapping
for o, n in mask:
r = {o: n}
mapping = {k.xreplace(r): v.xreplace(r)
for k, v in mapping.items()}
return rv, mapping
[docs] def find(self, query, group=False):
"""Find all subexpressions matching a query. """
query = _make_find_query(query)
results = list(filter(query, preorder_traversal(self)))
if not group:
return set(results)
else:
groups = {}
for result in results:
if result in groups:
groups[result] += 1
else:
groups[result] = 1
return groups
[docs] def count(self, query):
"""Count the number of matching subexpressions. """
query = _make_find_query(query)
return sum(bool(query(sub)) for sub in preorder_traversal(self))
[docs] def matches(self, expr, repl_dict={}, old=False):
"""
Helper method for match() that looks for a match between Wild symbols
in self and expressions in expr.
Examples
========
>>> from sympy import symbols, Wild, Basic
>>> a, b, c = symbols('a b c')
>>> x = Wild('x')
>>> Basic(a + x, x).matches(Basic(a + b, c)) is None
True
>>> Basic(a + x, x).matches(Basic(a + b + c, b + c))
{x_: b + c}
"""
expr = sympify(expr)
if not isinstance(expr, self.__class__):
return None
if self == expr:
return repl_dict
if len(self.args) != len(expr.args):
return None
d = repl_dict.copy()
for arg, other_arg in zip(self.args, expr.args):
if arg == other_arg:
continue
d = arg.xreplace(d).matches(other_arg, d, old=old)
if d is None:
return None
return d
[docs] def match(self, pattern, old=False):
"""
Pattern matching.
Wild symbols match all.
Return ``None`` when expression (self) does not match
with pattern. Otherwise return a dictionary such that::
pattern.xreplace(self.match(pattern)) == self
Examples
========
>>> from sympy import Wild
>>> from sympy.abc import x, y
>>> p = Wild("p")
>>> q = Wild("q")
>>> r = Wild("r")
>>> e = (x+y)**(x+y)
>>> e.match(p**p)
{p_: x + y}
>>> e.match(p**q)
{p_: x + y, q_: x + y}
>>> e = (2*x)**2
>>> e.match(p*q**r)
{p_: 4, q_: x, r_: 2}
>>> (p*q**r).xreplace(e.match(p*q**r))
4*x**2
The ``old`` flag will give the old-style pattern matching where
expressions and patterns are essentially solved to give the
match. Both of the following give None unless ``old=True``:
>>> (x - 2).match(p - x, old=True)
{p_: 2*x - 2}
>>> (2/x).match(p*x, old=True)
{p_: 2/x**2}
"""
pattern = sympify(pattern)
return pattern.matches(self, old=old)
[docs] def count_ops(self, visual=None):
"""wrapper for count_ops that returns the operation count."""
from sympy import count_ops
return count_ops(self, visual)
[docs] def doit(self, **hints):
"""Evaluate objects that are not evaluated by default like limits,
integrals, sums and products. All objects of this kind will be
evaluated recursively, unless some species were excluded via 'hints'
or unless the 'deep' hint was set to 'False'.
>>> from sympy import Integral
>>> from sympy.abc import x
>>> 2*Integral(x, x)
2*Integral(x, x)
>>> (2*Integral(x, x)).doit()
x**2
>>> (2*Integral(x, x)).doit(deep=False)
2*Integral(x, x)
"""
if hints.get('deep', True):
terms = [term.doit(**hints) if isinstance(term, Basic) else term
for term in self.args]
return self.func(*terms)
else:
return self
def _eval_rewrite(self, pattern, rule, **hints):
if self.is_Atom:
if hasattr(self, rule):
return getattr(self, rule)()
return self
if hints.get('deep', True):
args = [a._eval_rewrite(pattern, rule, **hints)
if isinstance(a, Basic) else a
for a in self.args]
else:
args = self.args
if pattern is None or isinstance(self.func, pattern):
if hasattr(self, rule):
rewritten = getattr(self, rule)(*args)
if rewritten is not None:
return rewritten
return self.func(*args)
[docs] def rewrite(self, *args, **hints):
""" Rewrite functions in terms of other functions.
Rewrites expression containing applications of functions
of one kind in terms of functions of different kind. For
example you can rewrite trigonometric functions as complex
exponentials or combinatorial functions as gamma function.
As a pattern this function accepts a list of functions to
to rewrite (instances of DefinedFunction class). As rule
you can use string or a destination function instance (in
this case rewrite() will use the str() function).
There is also the possibility to pass hints on how to rewrite
the given expressions. For now there is only one such hint
defined called 'deep'. When 'deep' is set to False it will
forbid functions to rewrite their contents.
Examples
========
>>> from sympy import sin, exp
>>> from sympy.abc import x
Unspecified pattern:
>>> sin(x).rewrite(exp)
-I*(exp(I*x) - exp(-I*x))/2
Pattern as a single function:
>>> sin(x).rewrite(sin, exp)
-I*(exp(I*x) - exp(-I*x))/2
Pattern as a list of functions:
>>> sin(x).rewrite([sin, ], exp)
-I*(exp(I*x) - exp(-I*x))/2
"""
if not args:
return self
else:
pattern = args[:-1]
if isinstance(args[-1], string_types):
rule = '_eval_rewrite_as_' + args[-1]
else:
rule = '_eval_rewrite_as_' + args[-1].__name__
if not pattern:
return self._eval_rewrite(None, rule, **hints)
else:
if iterable(pattern[0]):
pattern = pattern[0]
pattern = [p.__class__ for p in pattern if self.has(p)]
if pattern:
return self._eval_rewrite(tuple(pattern), rule, **hints)
else:
return self
[docs]class Atom(Basic):
"""
A parent class for atomic things. An atom is an expression with no subexpressions.
Examples
========
Symbol, Number, Rational, Integer, ...
But not: Add, Mul, Pow, ...
"""
is_Atom = True
__slots__ = []
def matches(self, expr, repl_dict={}, old=False):
if self == expr:
return repl_dict
def xreplace(self, rule, hack2=False):
return rule.get(self, self)
def doit(self, **hints):
return self
@classmethod
def class_key(cls):
return 2, 0, cls.__name__
@cacheit
def sort_key(self, order=None):
return self.class_key(), (1, (str(self),)), S.One.sort_key(), S.One
def _eval_simplify(self, ratio, measure):
return self
@property
def _sorted_args(self):
# this is here as a safeguard against accidentally using _sorted_args
# on Atoms -- they cannot be rebuilt as atom.func(*atom._sorted_args)
# since there are no args. So the calling routine should be checking
# to see that this property is not called for Atoms.
raise AttributeError('Atoms have no args. It might be necessary'
' to make a check for Atoms in the calling code.')
def _aresame(a, b):
"""Return True if a and b are structurally the same, else False.
Examples
========
To SymPy, 2.0 == 2:
>>> from sympy import S
>>> 2.0 == S(2)
True
Since a simple 'same or not' result is sometimes useful, this routine was
written to provide that query:
>>> from sympy.core.basic import _aresame
>>> _aresame(S(2.0), S(2))
False
"""
from .function import AppliedUndef, UndefinedFunction as UndefFunc
for i, j in zip_longest(preorder_traversal(a), preorder_traversal(b)):
if i != j or type(i) != type(j):
if ((isinstance(i, UndefFunc) and isinstance(j, UndefFunc)) or
(isinstance(i, AppliedUndef) and isinstance(j, AppliedUndef))):
if i.class_key() != j.class_key():
return False
else:
return False
else:
return True
def _atomic(e):
"""Return atom-like quantities as far as substitution is
concerned: Derivatives, Functions and Symbols. Don't
return any 'atoms' that are inside such quantities unless
they also appear outside, too.
Examples
========
>>> from sympy import Derivative, Function, cos
>>> from sympy.abc import x, y
>>> from sympy.core.basic import _atomic
>>> f = Function('f')
>>> _atomic(x + y)
set([x, y])
>>> _atomic(x + f(y))
set([x, f(y)])
>>> _atomic(Derivative(f(x), x) + cos(x) + y)
set([y, cos(x), Derivative(f(x), x)])
"""
from sympy import Derivative, Function, Symbol
pot = preorder_traversal(e)
seen = set()
try:
free = e.free_symbols
except AttributeError:
return {e}
atoms = set()
for p in pot:
if p in seen:
pot.skip()
continue
seen.add(p)
if isinstance(p, Symbol) and p in free:
atoms.add(p)
elif isinstance(p, (Derivative, Function)):
pot.skip()
atoms.add(p)
return atoms
class preorder_traversal(Iterator):
"""
Do a pre-order traversal of a tree.
This iterator recursively yields nodes that it has visited in a pre-order
fashion. That is, it yields the current node then descends through the
tree breadth-first to yield all of a node's children's pre-order
traversal.
For an expression, the order of the traversal depends on the order of
.args, which in many cases can be arbitrary.
Parameters
==========
node : sympy expression
The expression to traverse.
keys : (default None) sort key(s)
The key(s) used to sort args of Basic objects. When None, args of Basic
objects are processed in arbitrary order. If key is defined, it will
be passed along to ordered() as the only key(s) to use to sort the
arguments; if ``key`` is simply True then the default keys of ordered
will be used.
Yields
======
subtree : sympy expression
All of the subtrees in the tree.
Examples
========
>>> from sympy import symbols
>>> from sympy.core.basic import preorder_traversal
>>> x, y, z = symbols('x y z')
The nodes are returned in the order that they are encountered unless key
is given; simply passing key=True will guarantee that the traversal is
unique.
>>> list(preorder_traversal((x + y)*z, keys=None)) # doctest: +SKIP
[z*(x + y), z, x + y, y, x]
>>> list(preorder_traversal((x + y)*z, keys=True))
[z*(x + y), z, x + y, x, y]
"""
def __init__(self, node, keys=None):
self._skip_flag = False
self._pt = self._preorder_traversal(node, keys)
def _preorder_traversal(self, node, keys):
yield node
if self._skip_flag:
self._skip_flag = False
return
if isinstance(node, Basic):
if not keys and hasattr(node, '_argset'):
# LatticeOp keeps args as a set. We should use this if we
# don't care about the order, to prevent unnecessary sorting.
args = node._argset
else:
args = node.args
if keys:
if keys != True:
args = ordered(args, keys, default=False)
else:
args = ordered(args)
for arg in args:
for subtree in self._preorder_traversal(arg, keys):
yield subtree
elif iterable(node):
for item in node:
for subtree in self._preorder_traversal(item, keys):
yield subtree
def skip(self):
"""
Skip yielding current node's (last yielded node's) subtrees.
Examples
========
>>> from sympy.core import symbols
>>> from sympy.core.basic import preorder_traversal
>>> x, y, z = symbols('x y z')
>>> pt = preorder_traversal((x+y*z)*z)
>>> for i in pt:
... print(i)
... if i == x+y*z:
... pt.skip()
z*(x + y*z)
z
x + y*z
"""
self._skip_flag = True
def __next__(self):
return next(self._pt)
def __iter__(self):
return self
def _make_find_query(query):
"""Convert the argument of Basic.find() into a callable"""
try:
query = sympify(query)
except SympifyError:
pass
if isinstance(query, type):
return lambda expr: isinstance(expr, query)
elif isinstance(query, Basic):
return lambda expr: expr.match(query) is not None
return query


Esri Geospatial Platform Briefing
### Geospatial Platform
### Geospatial Platform
### Geospatial Platform
### Geospatial Platform
### Geospatial Platform
### Engagment and Collaboration
### [Engagment and Collaboration](https://healthcare-access-columbus.opendata.arcgis.com)
### [Apps](https://www.esri.com/en-us/arcgis/products/apps-for-everyone/overview.html), Field Mobility, Solutions...
### Apps, [Field Mobility](https://www.esri.com/en-us/arcgis/products/field-operations/overview), Solutions...
### Apps, Field Mobility, [Solutions](https://solutions.arcgis.com)...
### Data Driven [Dashboards](http://solutions.arcgis.com/local-government/help/citizen-problem-reporter/), BI, and Analytics
### Data Driven [Dashboards](https://solutions.arcgis.com/local-government/help/performance-management/), BI, and Analytics
### Patterns of Use
### Patterns of Use
### Patterns of Use
### Patterns of Use


{% load static %}
IdeaPost
Remember your ideas and collaborate with others with IdeaPost
Login
{% csrf_token %}
Username
Password
New account


The dream of a fully decentralized, anonymous Internet has been a long time coming.
Complete the form below to experience PiperNet.


Next: the, Previous: special, Up: Evaluation and Compilation Dictionary
locally
{declaration}* {form}* ⇒ {result}*
Declaration—a declare expression; not evaluated.
forms—an implicit progn.
results—the values of the forms.
Sequentially evaluates a body of forms in a lexical environment where the given declarations have effect.
(defun sample-function (y) ;this y is regarded as special (declare (special y)) (let ((y t)) ;this y is regarded as lexical (list y (locally (declare (special y)) ;; this next y is regarded as special y)))) ⇒ SAMPLE-FUNCTION (sample-function nil) ⇒ (T NIL) (setq x '(1 2 3) y '(4 . 5)) ⇒ (4 . 5) ;;; The following declarations are not notably useful in specific. ;;; They just offer a sample of valid declaration syntax using LOCALLY. (locally (declare (inline floor) (notinline car cdr)) (declare (optimize space)) (floor (car x) (cdr y))) ⇒ 0, 1
;;; This example shows a definition of a function that has a particular set ;;; of OPTIMIZE settings made locally to that definition. (locally (declare (optimize (safety 3) (space 3) (speed 0))) (defun frob (w x y &optional (z (foo x y))) (mumble x y z w))) ⇒ FROB ;;; This is like the previous example, except that the optimize settings ;;; remain in effect for subsequent definitions in the same compilation unit. (declaim (optimize (safety 3) (space 3) (speed 0))) (defun frob (w x y &optional (z (foo x y))) (mumble x y z w)) ⇒ FROB
The special declaration may be used with locally to affect references to, rather than bindings of, variables.
If a locally form is a top level form, the body forms are also processed as top level forms. See File Compilation.
Next: the, Previous: special, Up: Evaluation and Compilation Dictionary


'Bala' celeb review: Varun Dhawan, Ileana D'Cruz and other Bollywood stars laud the Ayushmann Khurrana starrer
by TIMESOFINDIA.COMAyushmann Khurrana is back in the spotlight for his latest comedy ‘Bala’. The film directed by Amar Kaushik that hit theatres today is not only tickling the audience’s funny bone but is also serving up some food for thought with its powerful message.
The comedy-drama promises a humorous ride with Ayushmann joined by Bhumi Pednekar and Yami Gautam in the lead. The film offers a quirky take on premature balding in men and is touted to possess all the ingredients of a true entertainer.
The quirky family entertainer, which is laden with several laugh-out-loud moments has not only got fans buzzy but earned some good reviews from Bollywood stars.
From Varun Dhawan to Ileana D’Cruz, here’s what celebs had to say about ‘Bala’.


I am very passionate about javascript i even want to develop apps using javascript because it is such a roboust language
Digital marketing is also one of my favorite topic so i am looking forward to be a freelancer digital marketer make some good money :)
I am very passionate to be a we developer and also a freelance marketer
Please feel free to reach me lets get talking github


Build SCION from sources following the instructions in the README and the tutorials.
Once you've saved your setup, you can download the configuration tarfile with the link below. After unpacking the gen/
to the SCION source directory, you can start your AS using the development scripts (scion.sh
and supervisor/supervisor.sh
), as described in the tutorial.


| DOSE: T+ 0:00 |
12 tablets |
oral |
DXM |
(pill / tablet) |
| |
|
oral |
Chlorpheniramine Maleate |
|
| T+ 4:00 |
|
smoked |
Cannabis |
|
[Erowid Warning: Most Coricidin contains CPM (Chlorpheniramine Maleate) which can be dangerous in high doses. See DXM Brand Warnings for more info.]
To start this report off, know that I have not had THAT much experience with many Hallucinagins, although I am always interested in trying new things. I have eaten shrooms on many occasions, and dropped acid once.
I had heard about DXM before,and wanted to try it, but i wasn't down with drinking a bottle of nyquill, and knew of no other way of trying it. A couple friends of mine had told me they tried Corciden, a cold remedy they got from our local pharmacy. The fact that it was pills eased my mind a bit, so I was down for taking it. I just had to get my hands on some. Which was easy considering I Work and a pharmacy.
A couple days later, while still thinking if i should try it, the opprotunity came in school. A couple of friends were taking it in school at our lunch period, so I figured, without having much knowledge of the drug at all, that I would do it then. After inquiring how many pills I should take, I settled on 12 pills. Considering my friend was popping 16, and another popped 8.
Now, I had lunch 7th period, which is just about 12:00pm, I had work that same day at 5pm.
As school ended I still was feeling no effects, School ends at 2:02 so I figured, 2 hours, no effect, I might as well forget about it and try a higher dossage for the next i wanted to try it. After school I went to a friends house, I arrive around 4pm and like always, decided to smoke some weed before work. Me and a friend finished smoking at about 4:30, we shared a pretty fat joint. This is when things got wierd.
I had gotten up after sitting down for a while, I did not feel high, I just had a weird type of dizzy feeling. I shrugged it off, and went to work. Now I live very close to my job, so i just walk their. As the minutes passed this dizzy feeing started to get more intense. I tried to shrug it off, thinking in my head that it Cant be the Corciden that I had taken many hours ago.
I arrived at work, and started to feel Completely trashed. I could not see straight, and was having trouble walking. My stomach was killing me, so I went into the back room. I sat down and realized that if anyone had seen me, they definitly would think I was on something. I went into the bathroom and tried to splash some water on my face, but I couldn't even manage to direct the water to my face. My pupils we're dilated, and I felt like complete garbage. I stayed in the backroom for about 15 minutes until a fellow employee, which is a friend of mine with come Corciden experience.
I talked to him for a bit and told him that something was wrong. After a little bit longer, A nasueus feeling came over me and I ran into the bathroom and threw up. After this the dizzyness died down, and I started to get my head straight. I went back into the store and found my manager screaming at me for being 15 minutes late. I looked like hell, so I told him I had just gotten sick and was going home. I went back to my friends house, it took a good 2-3 more hours for me to feel straight again.
This experience with Corciden was horrible. I probably will never try it again.  I dont know why it took so long to kick in, but Corciden affects diffrent people very diffrently. I suggest if you are thinking about trying DXM, don't mess around with cold pills for the high.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


{% load i18n %} {% blocktrans %}
Hello {{ old_user_name }},
Your card is no longer being used for autopayment on the account {{ billing_account_name }}.
A card belonging to {{new_user}} is being used instead. If this is expected, you do not have to take any further action, and this card will be used to pay monthly invoices and will be charged on the invoice due date. If this change is unexpected, you can view and alter the credit card information at any time by navigating to your Billing Information page.
Thank you for using CommCare. If you have any questions, please don't hesitate to contact {{ invoicing_contact_email }}.
Best Regards,
The CommCare HQ Team
www.commcarehq.org
Statement From: CommCare HQ and the corporation Dimagi, Inc. 585 Massachusetts Ave, Ste 3, Cambridge, MA 02139 USA
{% endblocktrans %}


The community hub is able to provide food shopping for local residents. Leave a message below and one of our volenteers will be in touch.
Return back to the Hub.


Website Development and Hosting
We can help you to take your business online as per your requirements with attaractive design that can lead customes to your business. We are experienced team wich can build ultimate website of your desired using latest developing technology.
We provide following services.. [Know more]
- Website Development (i.e. Static & Dynamic)
- Domain Purchasing
- Website Hosting
- Website Maintanance & Updation
- SEO report for your current website
- Live Monitoring of Website performance


Array
all?
(λ [(Ref (λ [&a] Bool)), (Ref (Array a))] Bool)
(all? f a)
Checks whether all of the elements in a
match the function f
.
any?
(λ [(Ref (λ [&a] Bool)), (Ref (Array a))] Bool)
(any? f a)
Checks whether any of the elements in a
match the function f
.
aupdate
(λ [(Array a), Int, (Ref (λ [&a] a))] (Array a))
(aupdate a i f)
Transmute the element at index i of array a using function f.
aupdate!
(λ [(Ref (Array a)), Int, (Ref (λ [&a] a))] ())
(aupdate! a i f)
Transmute the element at index i of array a using function f in place.
concat
(λ [(Ref (Array (Array a)))] (Array a))
(concat xs)
Returns a new Array which is the concatenation of the provided xs
.
copy-map
(λ [(Ref (λ [&a] b)), (Ref (Array a))] (Array b))
(copy-map f a)
Map over array a using function f (copies the array).
element-count
(λ [(Ref (Array a)), &a] Int)
(element-count a e)
Count occurrences of element e in an array.
enumerated
(λ [(Ref (Array a))] (Array (Pair Int a)))
(enumerated xs)
Create a new array of Pair:s where the first position is the index and the second position is the element from the original array.
find
(λ [(Ref (λ [&a] Bool)), (Ref (Array a))] a)
(find f a)
Finds an element in a
that matches the function f
.
find-index
(λ [(Ref (λ [&a] Bool)), (Ref (Array a))] Int)
(find-index f a)
Finds the index of the first element in a
that matches the function f
, or -1.
maximum
(λ [(Ref (Array a))] a)
(maximum xs)
Get the maximum in an array (elements must support <).
predicate-count
(λ [(Ref (Array a)), (Ref (λ [&a] Bool))] Int)
(predicate-count a pred)
Count number of elements satisfying predicate in an array.
prefix-array
(λ [(Ref (Array a)), Int] (Array a))
(prefix-array xs end-index)
Get prefix-array to end-index.
range
(λ [Int, Int, Int] (Array Int))
(range start end step)
Create an array from start to end with step between them (the elements must support <, <=, and >=).
reduce
(λ [(Ref (λ [a, &b] a)), a, (Ref (Array b))] a)
(reduce f x xs)
Reduce an array, using the function f.
remove
(λ [&a, (Array a)] (Array a))
(remove el arr)
Remove occurrences of element el in array arr, in-place
remove-nth
(λ [Int, (Array a)] (Array a))
(remove-nth i arr)
Remove element at index idx from arr
repeat
(λ [Int, (Ref (λ [] a))] (Array a))
(repeat n f)
Repeat function f n times and store the results in an array.
repeat-indexed
(λ [Int, (λ [Int] a)] (Array a))
(repeat-indexed n f)
Repeat function f n times and store the results in an array (will be supplied with the index).
replicate
(λ [Int, &a] (Array a))
(replicate n e)
Repeat element e n times and store the results in an array.
sort-by
(λ [(Array a), (Ref (λ [&a, &a] Bool))] (Array a))
(sort-by arr f)
Perform an in-place heapsort of a given owned array by a comparison function.
sort-by!
(λ [(Ref (Array a)), (Ref (λ [&a, &a] Bool))] ())
(sort-by! arr f)
Perform an in-place heapsort of a given array by a comparison function.
sorted
(λ [(Ref (Array a))] (Array a))
(sorted arr)
Perform a heapsort in a new copy of given array.
sorted-by
(λ [(Ref (Array a)), (Ref (λ [&a, &a] Bool))] (Array a))
(sorted-by arr f)
Perform a heapsort in a new copy of given array by a comparison function.
subarray
(λ [(Ref (Array a)), Int, Int] (Array a))
(subarray xs start-index end-index)
Get subarray from start-index to end-index.
suffix-array
(λ [(Ref (Array a)), Int] (Array a))
(suffix-array xs start-index)
Get subarray from start-index.
sum-length
(λ [(Ref (Array (Array a)))] Int)
(sum-length xs)
Returns the sum of lengths from an Array of Arrays.
swap!
(λ [(Ref (Array a)), Int, Int] ())
(swap! a i j)
Swap indices i and j of array a in place.
zip
(λ [(Ref (λ [&a, &b] c)), (Ref (Array a)), (Ref (Array b))] (Array c))
(zip f a b)
Map over two arrays using a function that takes two arguments. Produces a new array with the length of the shorter input.


Slate helps you see how many more days you need to work to reach
Slate helps you see how many more days you need to work to reach
Slate helps you see how many more days you need to work to reach your financial goal for the month and year.
Slate helps you see how many more days you need to work to reach.
Slate helps you see how many more days you need to work to reach
Slate helps you see how many more days you need to work to reach your financial goal for the month and year.
Slate helps you see how many more days work to reach.
Slate helps you see how many more days you need to work to reach.
This proved to be impossible using the traditional concepts of space and time.
Historically, the electron, for example, was thought to beh ave like a particle, absolute space and time.
They describe a universe co nsisting of bodies movin g with clockwork predicatability on a stage


Arrays and Hashes in Ruby
A brief review
18 Feb 15
During week 3 at DBC we went back and looked at basic Ruby syntax. A part of that was looking at hashes and arrays. Well arrays more than hashes. These two parts of Ruby syntax are commonly used in many different applications. We will take these two methods of storing data and look at them one by one.
Arrays
my_empty_array = [] || my_empty_array = Array.new foo_array = ['foo','foos','fouie','food','fool',2,2.05 ] array_of_arrays = [[2,3,4],['foo','food','foos'],[2.0,3.1,5.6]]
Above are three arrays. The first one is an empty array assigned to a variable. Empty arrays are useful if you plan on adding elements to it later in the program. For example; if you want to search a string for a particular pattern and push the sentence around what you are looking for to an array, you could start with an empty array. The second example above shows that you can have many different types of objects contained within a specific instance of an array. This means that you can even nest arrays within arrays as shown in the third example. This ability allows arrays to be extremely flexible
puts foo_array[0] => 'foo' puts foo_array[2] => 'fouie' puts foo_array[-1] => 2.05 puts array_of_arrays[2][2] => 'food'
We have seen how to use arrays to store data, but how do we retrieve the data we have stored? Arrays, like strings, have the first element in the array named [0]
, the second [1]
and so on. So if you need the third element out of foo_array you would type foo_array[2]
as shown above. If you need to pull the last element out of an array you could see how long the array is and subtract one to get the index OR you can use [-1]
which points to the last element in any array. [-2]
would point to the second to last and so on. This is very useful if you have a constructed array of indeterminate length and need to access the last element.
array_of_arrays.flatten => [2,3,4,'foo','food','foos',2.0,3.1,5.6] ruby_array = ['c','e','g','f','b','d','a'] ruby_array.sort => ['a','b','c','d','e','f','g'] ruby_array.length => 7 [[1.1,2.2,3.3],[1,2,3]].flatten.sort => [1,1.1,2,2.2,3,3.3]
The code snippets above show a couple of common array method calls and their results. The .flatten
method takes an array of arrays and removes the interior arrays creating a single array. We applied it to our array_of_arrays
from earlier. .sort
takes the elements of the array and sorts them, either in alphabetical order or numerical order from either a..z
or 1..100
. If you need the array reversed you can apply the .reverse
method! Another useful array method is .length
. This method outputs the length of the array in elements as an integer. As you can see above, we have called this method on our ruby_array
yielding 7
. The final example shows two methods called directly on an array, not just it's variable. The .sort
method allows you to mix floats and integers, but not strings and fixnums.
Hashes
dbc_hash = Hash.new || dbc_hash = {} my_info = { first_name: 'Jack', last_name: 'Zampolin', hometown: 'Richmond', age: 28, } puts my_info[:first_name] => 'Jack' my_info[:current_town] = 'Bozeman' puts my_info[:current_town] => 'Bozeman'
Shown above is the basic syntax for hashes in Ruby. The first line shows the literal notation for initializing a new hash. my_info
shows an example hash. As you can see, the individual elements in the hash are key-value pairs. So, the :first_name
refers to the value 'Jack'
. Data is extracted from hashes by naming the key. You can see this at work in the 3rd line of the example. If you want to add a key-value pair to an existing hash the notation is shown in the fourth line. Hashes, like arrays, have methods to manipulate and view data within them. Hashes are mainly used in Ruby to create and hold classes. But that topic is slightly beyond the remit of this post, but I have a feeling that we will cover classes in a later post. Stay tuned.


Most regular expression engines, and Perl is no different, recognise twelve basic metacharacters. (Most of these are also listed elsewhere.)
| |
Item
|
|
Meaning:
|
|
| |
.
|
|
Matches any character except a new line. If used in “dot matches all mode” also matches a new line.
|
|
| |
^
|
|
Matches start of a string. If used in multiline mode also matches beginning of each line, (i.e. after a newline).
|
|
| |
$
|
|
Matches end of a string.
If used in multiline mode also matches end of each line, (i.e. before a newline).
|
|
|
?
|
|
Match the previous character or group 1 time, if possible.
|
|
| |
+
|
|
Match the previous character or group as many times as possible, but at least 1 time.
|
|
| |
*
|
|
Match the previous character or group as many times as possible.
|
|
| |
{Number}
{Min,}
{Min,Max}
|
|
Match a number of times.
Number can be either a single number, a minimum, or a minimum and a maximum. (See quantifiers.)
|
|
| |
(…)
|
|
Capturing parentheses.
|
|
| |
[…]
|
|
Character class.
Matches any one character between the square brackets.
|
|
| |
…|…
|
|
Alternation.
Matches either the expression on the left or the right side.
|
|
| |
\…
|
|
Quote, i.e. normalise, the next metacharacter.
|
|
| |
|
In the table “…” stands for any one or more characters.
|


The integration service allows to initiate the payment. The wording of PayOne differ to Commercetools. Due to the delay till the payment will not be able to charge immediately.
It will do so by sending an pre authorization request to the PAYONE platform.
It will store information about such a request as an interface interaction of type
PAYONE_INTERACTION_REQUEST.
Given the following payments for a bank account that and does not support charges for currencies other than EUR:
| Payment Name | Cent Amount | Currency Code | Payment ID (for information only) |
|---|---|---|---|
| Payment 1 | 406 | EUR | |
| Payment 2 | 91341 | USD | |
| Payment 3 | 8231 | EUR | |
| Payment 4 | 123411 | EUR |
When I request the integration service to handle them I will get the following results:
| Payment Name | Response Status Code |
total # of authorization requests sent |
Transaction State |
|---|---|---|---|
| Payment 1 | 200 | 0 | Pending |
| Payment 2 | 200 | 0 | Failure |
| Payment 3 | 200 | 0 | Pending |
| Payment 4 | 200 | 0 | Pending |


@* * Copyright 2023 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @(params: Map[String, Any]) @uk.gov.hmrc.hmrcemailrenderer.templates.helpers.html.template_main(params, "You’ve signed up your client for Making Tax Digital for VAT") {
Dear Agent
You have signed up your client to use software to submit their VAT Returns.
Your client’s VAT registration number is:
@params("vatNumber")
You must tell your client that you have signed them up for Making Tax Digital for VAT
What you need to do next
Your client can view their VAT Return deadlines in their accounting software or business tax account.
Why you are receiving this email
We send a confirmation email when you sign up a client.
From HMRC Making Tax Digital for Business VAT
}


To SQL or No(t to)SQL - That Is The Question!
SQL
SQL - or Structured Query Language - was one of the first commercial languages for Edgar F. Codd's relational model (essecntially SQL was designed to express relational algebra - think Venn diagrams) that subsequently went on to become the most widely used database language. Another fine product from the good folks at IBM it was developed in the early 1970s. A significant drawback to the language is that it's not portable among systems - you have Oracle, Microsoft, MySQL and about a dozen others - which while they share much of the same syntax are unique enough to cause headaches were one to undertake a database conversion. And while I have used SQL databases (Oracle flavored) to handled large, complex data sets (millions of user records of two primary sub-categories: donors and prospects) I can attest to the fact that it was not designed with that sort of scale in mind. It is much more in keeping with a small college's alumni/alumnae data needs than a multi-national non-profit's.
Pros
- Allows for immediate insertion, deletion and retrieval of data with simple commands
- Allows users to take on administrative functions and manage the database
- It is easy to learn
- At this point it's essentially a universal language
Cons
- Lack of portability/proprietary extensions ensuring vendor lock-in.
- Interfacing is more complex than a few lines of code that NoSQL requires.
- Scalability is hindered in SQL relational models.
Types
While they are all essentially the same type there are a few "flavors" to choose from:- Oracle
- Microsoft
- MySQL
- PostgreSQL
- and ~9 others
NoSQL
NoSQL - or Not Only SQL - came to be nearly three decades after SQL's development. The evolution of NoSQL came from the sheer volume of data stored about users, objects, etc. and the frequency with which said data was accessed along with performance and processing needs. In SQL terms one could say that NoSQL has but two columns - the key and the value. And you'd select a NoSQL solution over a SQL one for the basic reason of scalability.
Pros
- Can handle large volumnes of structured, semi-structured and unstructured data
- Can handle agile sprints, quick iteration and frequent code pushes
- And is object orient programming - thus easy to use and flexible
Cons
- Data aggregation is less powerful than the SQL relational model.
- Many of the NoSQL platforms do not support transactions (unit of work performed against a database using commands of commit, rollback, savepoint and set transaction.)
- While NoSQL databases are designed to require less management it also means there's less support waiting when something does go wrong.
Types
There appears to be quite the variety of NoSQL flavors to choose from:- Document Store - pairs each key with a complex data structure known as a document. Documents can contain many different KV pairs or key array pairs or even nested documents. Used for collections, tags, non-visible meta data, directory hierarchies (e.g. MongoDB)
- Graph Databases - good for data whose relationships are best represented by a graph such as social connections, public transportation links, road maps, network topologies
- Key Value (a.k.a. Row Store) with a host of sub-types - simplest of the NoSQL types, used (e.g. Riak)
- Wide Column Store - optimized for queries over large data sets and store columns of data rather than rows (e.g. Cassandra, Hadoop)
- Object Databases - usually developed with language specific usage which limits wide adoption
- Multimodal Databases
- Grid and Cloud Database Solutions
- XML Databases
- and undoubtedly quite a few others
The Future
Having had somewhat significant exposure to (and experience with) SQL databases I'm looking forward to better understanding the world of NoSQL ones. I have a fondness for relational databases but can see the value of and need for something more scalable and nimble. I think I'll build mine in periwinkle...


GEMFILE(5) GEMFILE(5)
NAME
Gemfile - A format for describing gem dependencies for Ruby programs
SYNOPSIS
A Gemfile describes the gem dependencies required to execute associated Ruby code. Place the Gemfile in the root of the directory containing the associ- ated code. For instance, in a Rails application, place the Gemfile in the same directory as the Rakefile.
SYNTAX
A Gemfile is evaluated as Ruby code, in a context which makes available a number of methods used to describe the gem requirements.
SOURCES (source)
At the top of the Gemfile, add one line for each Rubygems source that might contain the gems listed in the Gemfile. source "https://rubygems.org" source "http://gems.github.com" Each of these _source_s MUST be a valid Rubygems repository. Sources are checked for gems following the heuristics described in SOURCE PRI- ORITY.
RUBY (ruby)
If your application requires a specific Ruby version or engine, specify your requirements using the ruby method, with the following arguments. All parameters are OPTIONAL unless otherwise specified. VERSION (required) The version of Ruby that your application requires. If your application requires an alternate Ruby engine, such as JRuby or Rubinius, this should be the Ruby version that the engine is compatible with. ruby "1.9.3" ENGINE (:engine) Each application may specify a Ruby engine. If an engine is specified, an engine version must also be specified. ENGINE VERSION (:engine_version) Each application may specify a Ruby engine version. If an engine ver- sion is specified, an engine must also be specified. If the engine is "ruby" the engine version specified must match the Ruby version. ruby "1.8.7", :engine => "jruby", :engine_version => "1.6.7"
GEMS (gem)
Specify gem requirements using the gem method, with the following argu- ments. All parameters are OPTIONAL unless otherwise specified. NAME (required) For each gem requirement, list a single gem line. gem "nokogiri" VERSION Each gem MAY have one or more version specifiers. gem "nokogiri", ">= 1.4.2" gem "RedCloth", ">= 4.1.0", "< 4.2.0" REQUIRE AS (:require) Each gem MAY specify files that should be used when autorequiring via Bundler.require. You may pass an array with multiple files, or false to prevent any file from being autorequired. gem "redis", :require => ["redis/connection/hiredis", "redis"] gem "webmock", :require => false The argument defaults to the name of the gem. For example, these are identical: gem "nokogiri" gem "nokogiri", :require => "nokogiri" GROUPS (:group or :groups) Each gem MAY specify membership in one or more groups. Any gem that does not specify membership in any group is placed in the default group. gem "rspec", :group => :test gem "wirble", :groups => [:development, :test] The Bundler runtime allows its two main methods, Bundler.setup and Bundler.require, to limit their impact to particular groups. # setup adds gems to Ruby's load path Bundler.setup # defaults to all groups require "bundler/setup" # same as Bundler.setup Bundler.setup(:default) # only set up the _default_ group Bundler.setup(:test) # only set up the _test_ group (but `not` _default_) Bundler.setup(:default, :test) # set up the _default_ and _test_ groups, but no others # require requires all of the gems in the specified groups Bundler.require # defaults to just the _default_ group Bundler.require(:default) # identical Bundler.require(:default, :test) # requires the _default_ and _test_ groups Bundler.require(:test) # requires just the _test_ group The Bundler CLI allows you to specify a list of groups whose gems bun- dle install should not install with the --without option. To specify multiple groups to ignore, specify a list of groups separated by spa- ces. bundle install --without test bundle install --without development test After running bundle install --without test, bundler will remember that you excluded the test group in the last installation. The next time you run bundle install, without any --without option, bundler will recall it. Also, calling Bundler.setup with no parameters, or calling require "bundler/setup" will setup all groups except for the ones you excluded via --without (since they are obviously not available). Note that on bundle install, bundler downloads and evaluates all gems, in order to create a single canonical list of all of the required gems and their dependencies. This means that you cannot list different ver- sions of the same gems in different groups. For more details, see Understanding Bundler http://gembundler.com/rationale.html. PLATFORMS (:platforms) If a gem should only be used in a particular platform or set of plat- forms, you can specify them. Platforms are essentially identical to groups, except that you do not need to use the --without install-time flag to exclude groups of gems for other platforms. There are a number of Gemfile platforms: ruby C Ruby (MRI) or Rubinius, but NOT Windows ruby_18 ruby AND version 1.8 ruby_19 ruby AND version 1.9 ruby_20 ruby AND version 2.0 mri Same as ruby, but not Rubinius mri_18 mri AND version 1.8 mri_19 mri AND version 1.9 mri_20 mri AND version 2.0 rbx Same as ruby, but only Rubinius (not MRI) jruby JRuby mswin Windows mingw Windows 'mingw32' platform (aka RubyInstaller) mingw_18 mingw AND version 1.8 mingw_19 mingw AND version 1.9 mingw_20 mingw AND version 2.0 As with groups, you can specify one or more platforms: gem "weakling", :platforms => :jruby gem "ruby-debug", :platforms => :mri_18 gem "nokogiri", :platforms => [:mri_18, :jruby] All operations involving groups (bundle install, Bundler.setup, Bundler.require) behave exactly the same as if any groups not matching the current platform were explicitly excluded. GIT (:git) If necessary, you can specify that a gem is located at a particular git repository. The repository can be public (http://github.com/rails/rails.git) or private (git@github.com:rails/rails.git). If the repository is private, the user that you use to run bundle install MUST have the appropriate keys available in their $HOME/.ssh. Git repositories are specified using the :git parameter. The group, platforms, and require options are available and behave exactly the same as they would for a normal gem. gem "rails", :git => "git://github.com/rails/rails.git" A git repository SHOULD have at least one file, at the root of the directory containing the gem, with the extension .gemspec. This file MUST contain a valid gem specification, as expected by the gem build command. It MUST NOT have any dependencies, other than on the files in the git repository itself and any built-in functionality of Ruby or Rubygems. If a git repository does not have a .gemspec, bundler will attempt to create one, but it will not contain any dependencies, executables, or C extension compilation instructions. As a result, it may fail to prop- erly integrate into your application. If a git repository does have a .gemspec for the gem you attached it to, a version specifier, if provided, means that the git repository is only valid if the .gemspec specifies a version matching the version specifier. If not, bundler will print a warning. gem "rails", "2.3.8", :git => "git://github.com/rails/rails.git" # bundle install will fail, because the .gemspec in the rails # repository's master branch specifies version 3.0.0 If a git repository does not have a .gemspec for the gem you attached it to, a version specifier MUST be provided. Bundler will use this ver- sion in the simple .gemspec it creates. Git repositories support a number of additional options. branch, tag, and ref You MUST only specify at most one of these options. The default is :branch => "master" submodules Specify :submodules => true to cause bundler to expand any sub- modules included in the git repository If a git repository contains multiple .gemspecs, each .gemspec repre- sents a gem located at the same place in the file system as the .gem- spec. |~rails [git root] | |-rails.gemspec [rails gem located here] |~actionpack | |-actionpack.gemspec [actionpack gem located here] |~activesupport | |-activesupport.gemspec [activesupport gem located here] |... To install a gem located in a git repository, bundler changes to the directory containing the gemspec, runs gem build name.gemspec and then installs the resulting gem. The gem build command, which comes standard with Rubygems, evaluates the .gemspec in the context of the directory in which it is located. GITHUB (:github) If the git repository you want to use is hosted on GitHub and is pub- lic, you can use the :github shorthand to specify just the github user- name and repository name (without the trailing ".git"), separated by a slash. If both the username and repository name are the same, you can omit one. gem "rails", :github => "rails/rails" gem "rails", :github => "rails" Are both equivalent to gem "rails", :git => "git://github.com/rails/rails.git" PATH (:path) You can specify that a gem is located in a particular location on the file system. Relative paths are resolved relative to the directory con- taining the Gemfile. Similar to the semantics of the :git option, the :path option requires that the directory in question either contains a .gemspec for the gem, or that you specify an explicit version that bundler should use. Unlike :git, bundler does not compile C extensions for gems specified as paths. gem "rails", :path => "vendor/rails"
BLOCK FORM OF GIT, PATH, GROUP and PLATFORMS
The :git, :path, :group, and :platforms options may be applied to a group of gems by using block form. git "git://github.com/rails/rails.git" do gem "activesupport" gem "actionpack" end platforms :ruby do gem "ruby-debug" gem "sqlite3" end group :development do gem "wirble" gem "faker" end In the case of the git block form, the :ref, :branch, :tag, and :sub- modules options may be passed to the git method, and all gems in the block will inherit those options.
GEMSPEC (gemspec)
If you wish to use Bundler to help install dependencies for a gem while it is being developed, use the gemspec method to pull in the dependen- cies listed in the .gemspec file. The gemspec method adds any runtime dependencies as gem requirements in the default group. It also adds development dependencies as gem requirements in the development group. Finally, it adds a gem require- ment on your project (:path => '.'). In conjunction with Bundler.setup, this allows you to require project files in your test code as you would if the project were installed as a gem; you need not manipulate the load path manually or require project files via relative paths. The gemspec method supports optional :path, :name, and :develop- ment_group options, which control where bundler looks for the .gemspec, what named .gemspec it uses (if more than one is present), and which group development dependencies are included in.
SOURCE PRIORITY
When attempting to locate a gem to satisfy a gem requirement, bundler uses the following priority order: 1. The source explicitly attached to the gem (using :path or :git) 2. For implicit gems (dependencies of explicit gems), any git or path repository otherwise declared. This results in bundler prioritizing the ActiveSupport gem from the Rails git repository over ones from rubygems.org 3. The sources specified via source, searching each source in your Gemfile from last added to first added. March 2013 GEMFILE(5)
Generated with the Darkfish Rdoc Generator 2.


Why Billiat Was Missing For Chiefs…
by Soccer LadumaIt was a day to forget for Kaizer Chiefs as they bombed out of Telkom Knockout in Nelspruit on Saturday, but why was their star player, Khama Billiat, left out of the matchday squad?
Read: Dolly Boost For European Chase
Having commented on the tie earlier in the week, it was thought that the Zimbabwean international would be out to play a starring role for the Glamour Boys as they took aim at a place in the TKO final, but eyebrows were raised when he wasn’t even in the squad, let alone the starting XI.
It turns out, however, that Ernst Middendorp’s decision to leave the attacker out of his side for the game – which Chiefs went on to lose 2-1 – was not a tactical one, but because of a fitness issue that Billiat has been dealing with.
The club confirmed on their social media ahead of kick off at Mbombela Stadium, “Khama Billiat reported to national team duty with a tight hamstring… After playing 2 matches with it, it is still niggling. He has been treated but it hasn’t recovered sufficiently for him to be eligible for selection.”
Read: Khune Is ‘Medically Fit’ At Chiefs
It remains to be seen whether the 29-year-old will be deemed fit enough for next week’s game against Stellenbosch FC on Wednesday night, but Middendorp will be itching for his side to regroup and refocus following today’s disappointment.


There are 15 distinct sounds within the Māori alphabet.
They are:
While there are only five vowels, combinations of vowels (diphthongs) are common eg. au, ao, ea, oi, ua.
A vowel can also have a long or short sound. A long sound is usually denoted by a macron (a bar appearing over a vowel to indicate it is lengthened during pronunciation eg. ā as in wāhi).
Vowels are pronounced as follows:
Pronounce consonants as you would in English, with two key exceptions:
T The ‘t’ sound depends on which vowel appears after it. When it follows an ‘a’, ‘e’ or ‘o’, pronounce it with as little sibilant sound as possible (almost like a ‘d’). When it follows an ‘i’ or ‘u’, it includes a slight sibilant sound, but not nearly as much as an English ‘t’.
R Pronounced as a soft ‘rolled’ r.
The ‘ng’ digraph is pronounced as it sounds in the English word ‘singer'.
The ‘wh’ digraph originally sounded like the ‘wh’ in ‘whisper’, but in most dialects has evolved to be more like the English ‘f’ sound.
For further information about reo Māori pronunciation visit the Kōrero Māori website.
Information sourced from Victoria University


Technical full-stack development bootcamp student at Northwestern University with a background in Sales, Account Management and Operations at fast-growing, SaaS startups seeking a full-time development internship.
• Coordinated effort to map the customer journey for new and migrating clients, identifying key touch points and establishing written guidelines for how each team should engage with each type of client.
• Worked cross-functionally to build, develop and refine a process to manage large-scale global client migrations onto TT’s new cloud based platform.
• Partnered with Sales and Customer Success leadership to identify and build key business, sales and customer health reports to measure and monitor at the global, regional and individual level.
• Collaborated with Product leadership to implement and manage a process to prioritize feature and enhancement requests and product migration blockers for global Sales and Customer Success teams.
• Successfully rolled out a Net Promoter Score (NPS) survey to gage overall customer satisfaction and loyalty.
• Developed and implemented a repeatable sales process to generate predictable high quality lead flow to support Directors of Business Development nationwide.
• Achieved 87.5%, 100% and 175% to meetings set quota in three full months in the position.
• Responsible for generating new sales opportunities for 2 Directors of Business Development that each held an annual quota of $2,500,000.
• Consistently performed outbound prospecting campaigns including 40-60 daily calls and strategic personalized emails segmented by each prospect’s role, organization and region.
• Averaged 15-20 new sales opportunities monthly (Average Deal Size ~ $268,000).
• Developed and implemented a repeatable sales process for the delivery and execution of product demonstrations. Helped sales team increase win rate from 25% to 45% on qualified opportunities by creating sales deck content and hosting professional development seminars.
• Helped build and execute custom product demonstrations for enterprise clients and businesses that had complex workflows.
• Aggregated and communicated new customer requirements and feature requests to the product development team.
• Prepared new hires by conducting an orientation to the sales, product and product demonstration process.
• Developed and sustained long-term customer relationships with a portfolio of several hundred clients.
• Assisted with all aspects of the customer lifecycle, from participating in the sales process, to managing the on-boarding process and support of accounts.
• Collected and quantified product feedback to inform our product development roadmap and customer processes.
• Took a leadership role on the Customer Success team and helped organize and run weekly team meetings.
• Oversaw the development of the Front Desk Staff Manual, Front Desk Client Guide and training of new team members.
Concentration: Global Management
Minor: Economics
HTML5, CSS3, Bootstrap, Materialize, Media Queries, JavaScript, jQuery, APIs, JSON, REST, AJAX. Git, Github, Node.js, Express, Handlebars.js, React.js, MongoDB & MySQL.


Create Room
Create free audio calling room and enjoy
Name
Email Address
Password
Create
Want to join a Room?
Join Now
.


Home
Rules
Highscores
Logout
Highscores
List of the players that solved it in least moves. Time highscorese to be added.


Runs Graph PSNR PSNR-HVS SSIM FASTSSIM Total ⟵Click runs on the left to select. Logarithmic BD rate Current job No jobs running Job queue Submit job Run ID Commit Hash Key


I thought GitHub would be a good place to share my solutions for the try its, review questions, drills, and exercises for the afore mentioned book.
I will be using Microsoft Visual Studio Community to go through this book. I created a solution folder named PPP and added projects under the PPP solution for each section. In the solution Configuration Properties I selected build for the section I'm working on and deselect the others. If the sections contain mutliple files with a main function I just select Exclude from Project for the files I'm not working on in the solution explorer tab. Can always go back and add files back by selecting Include in Project. In the Solution Explorer tab you can select view all files to see all the included and excluded files.
If you're reading along you will notice I intentionally left out the header file mentioned in the book. Instead I created a section header file for each of the sections because in the book's presented header file the functions have been implimented into most modern compilers, plus I wanted some experiance dealing with custom header files. If you want, you can get the header file from book's website www.stroustrup.com/Programming
I'm new at this so any suggestions or comments are appreciated.