"""
Main Random Variables Module
Defines abstract random variable type.
Contains interfaces for probability space object (PSpace) as well as standard
operators, P, E, sample, density, where
See Also
========
sympy.stats.crv
sympy.stats.frv
sympy.stats.rv_interface
"""
from __future__ import print_function, division
from sympy import (Basic, S, Expr, Symbol, Tuple, And, Add, Eq, lambdify,
Equality, Lambda, DiracDelta, sympify)
from sympy.core.relational import Relational
from sympy.logic.boolalg import Boolean
from sympy.solvers.solveset import solveset
from sympy.sets.sets import FiniteSet, ProductSet, Intersection
from sympy.abc import x
[docs]class RandomDomain(Basic):
"""
Represents a set of variables and the values which they can take
See Also
========
sympy.stats.crv.ContinuousDomain
sympy.stats.frv.FiniteDomain
"""
is_ProductDomain = False
is_Finite = False
is_Continuous = False
def __new__(cls, symbols, *args):
symbols = FiniteSet(*symbols)
return Basic.__new__(cls, symbols, *args)
@property
def symbols(self):
return self.args[0]
@property
def set(self):
return self.args[1]
def __contains__(self, other):
raise NotImplementedError()
def integrate(self, expr):
raise NotImplementedError()
[docs]class SingleDomain(RandomDomain):
"""
A single variable and its domain
See Also
========
sympy.stats.crv.SingleContinuousDomain
sympy.stats.frv.SingleFiniteDomain
"""
def __new__(cls, symbol, set):
assert symbol.is_Symbol
return Basic.__new__(cls, symbol, set)
@property
def symbol(self):
return self.args[0]
@property
def symbols(self):
return FiniteSet(self.symbol)
def __contains__(self, other):
if len(other) != 1:
return False
sym, val = tuple(other)[0]
return self.symbol == sym and val in self.set
[docs]class ConditionalDomain(RandomDomain):
"""
A RandomDomain with an attached condition
See Also
========
sympy.stats.crv.ConditionalContinuousDomain
sympy.stats.frv.ConditionalFiniteDomain
"""
def __new__(cls, fulldomain, condition):
condition = condition.xreplace(dict((rs, rs.symbol)
for rs in random_symbols(condition)))
return Basic.__new__(cls, fulldomain, condition)
@property
def symbols(self):
return self.fulldomain.symbols
@property
def fulldomain(self):
return self.args[0]
@property
def condition(self):
return self.args[1]
@property
def set(self):
raise NotImplementedError("Set of Conditional Domain not Implemented")
def as_boolean(self):
return And(self.fulldomain.as_boolean(), self.condition)
[docs]class PSpace(Basic):
"""
A Probability Space
Probability Spaces encode processes that equal different values
probabilistically. These underly Random Symbols which occur in SymPy
expressions and contain the mechanics to evaluate statistical statements.
See Also
========
sympy.stats.crv.ContinuousPSpace
sympy.stats.frv.FinitePSpace
"""
is_Finite = None
is_Continuous = None
is_real = None
@property
def domain(self):
return self.args[0]
@property
def density(self):
return self.args[1]
@property
def values(self):
return frozenset(RandomSymbol(self, sym) for sym in self.domain.symbols)
@property
def symbols(self):
return self.domain.symbols
def where(self, condition):
raise NotImplementedError()
def compute_density(self, expr):
raise NotImplementedError()
def sample(self):
raise NotImplementedError()
def probability(self, condition):
raise NotImplementedError()
def integrate(self, expr):
raise NotImplementedError()
[docs]class SinglePSpace(PSpace):
"""
Represents the probabilities of a set of random events that can be
attributed to a single variable/symbol.
"""
def __new__(cls, s, distribution):
if isinstance(s, str):
s = Symbol(s)
if not isinstance(s, Symbol):
raise TypeError("s should have been string or Symbol")
return Basic.__new__(cls, s, distribution)
@property
def value(self):
return RandomSymbol(self, self.symbol)
@property
def symbol(self):
return self.args[0]
@property
def distribution(self):
return self.args[1]
@property
def pdf(self):
return self.distribution.pdf(self.symbol)
[docs]class RandomSymbol(Expr):
"""
Random Symbols represent ProbabilitySpaces in SymPy Expressions
In principle they can take on any value that their symbol can take on
within the associated PSpace with probability determined by the PSpace
Density.
Random Symbols contain pspace and symbol properties.
The pspace property points to the represented Probability Space
The symbol is a standard SymPy Symbol that is used in that probability space
for example in defining a density.
You can form normal SymPy expressions using RandomSymbols and operate on
those expressions with the Functions
E - Expectation of a random expression
P - Probability of a condition
density - Probability Density of an expression
given - A new random expression (with new random symbols) given a condition
An object of the RandomSymbol type should almost never be created by the
user. They tend to be created instead by the PSpace class's value method.
Traditionally a user doesn't even do this but instead calls one of the
convenience functions Normal, Exponential, Coin, Die, FiniteRV, etc....
"""
def __new__(cls, pspace, symbol):
if not isinstance(symbol, Symbol):
raise TypeError("symbol should be of type Symbol")
if not isinstance(pspace, PSpace):
raise TypeError("pspace variable should be of type PSpace")
return Basic.__new__(cls, pspace, symbol)
is_finite = True
is_Symbol = True
is_Atom = True
_diff_wrt = True
pspace = property(lambda self: self.args[0])
symbol = property(lambda self: self.args[1])
name = property(lambda self: self.symbol.name)
def _eval_is_positive(self):
return self.symbol.is_positive
def _eval_is_integer(self):
return self.symbol.is_integer
def _eval_is_real(self):
return self.symbol.is_real or self.pspace.is_real
@property
def is_commutative(self):
return self.symbol.is_commutative
def _hashable_content(self):
return self.pspace, self.symbol
@property
def free_symbols(self):
return {self}
[docs]class ProductPSpace(PSpace):
"""
A probability space resulting from the merger of two independent probability
spaces.
Often created using the function, pspace
"""
def __new__(cls, *spaces):
rs_space_dict = {}
for space in spaces:
for value in space.values:
rs_space_dict[value] = space
symbols = FiniteSet(*[val.symbol for val in rs_space_dict.keys()])
# Overlapping symbols
if len(symbols) < sum(len(space.symbols) for space in spaces):
raise ValueError("Overlapping Random Variables")
if all(space.is_Finite for space in spaces):
from sympy.stats.frv import ProductFinitePSpace
cls = ProductFinitePSpace
if all(space.is_Continuous for space in spaces):
from sympy.stats.crv import ProductContinuousPSpace
cls = ProductContinuousPSpace
obj = Basic.__new__(cls, *FiniteSet(*spaces))
return obj
@property
def rs_space_dict(self):
d = {}
for space in self.spaces:
for value in space.values:
d[value] = space
return d
@property
def symbols(self):
return FiniteSet(*[val.symbol for val in self.rs_space_dict.keys()])
@property
def spaces(self):
return FiniteSet(*self.args)
@property
def values(self):
return sumsets(space.values for space in self.spaces)
def integrate(self, expr, rvs=None, **kwargs):
rvs = rvs or self.values
rvs = frozenset(rvs)
for space in self.spaces:
expr = space.integrate(expr, rvs & space.values, **kwargs)
return expr
@property
def domain(self):
return ProductDomain(*[space.domain for space in self.spaces])
@property
def density(self):
raise NotImplementedError("Density not available for ProductSpaces")
def sample(self):
return dict([(k, v) for space in self.spaces
for k, v in space.sample().items()])
[docs]class ProductDomain(RandomDomain):
"""
A domain resulting from the merger of two independent domains
See Also
========
sympy.stats.crv.ProductContinuousDomain
sympy.stats.frv.ProductFiniteDomain
"""
is_ProductDomain = True
def __new__(cls, *domains):
symbols = sumsets([domain.symbols for domain in domains])
# Flatten any product of products
domains2 = []
for domain in domains:
if not domain.is_ProductDomain:
domains2.append(domain)
else:
domains2.extend(domain.domains)
domains2 = FiniteSet(*domains2)
if all(domain.is_Finite for domain in domains2):
from sympy.stats.frv import ProductFiniteDomain
cls = ProductFiniteDomain
if all(domain.is_Continuous for domain in domains2):
from sympy.stats.crv import ProductContinuousDomain
cls = ProductContinuousDomain
return Basic.__new__(cls, *domains2)
@property
def sym_domain_dict(self):
return dict((symbol, domain) for domain in self.domains
for symbol in domain.symbols)
@property
def symbols(self):
return FiniteSet(*[sym for domain in self.domains
for sym in domain.symbols])
@property
def domains(self):
return self.args
@property
def set(self):
return ProductSet(domain.set for domain in self.domains)
def __contains__(self, other):
# Split event into each subdomain
for domain in self.domains:
# Collect the parts of this event which associate to this domain
elem = frozenset([item for item in other
if sympify(domain.symbols.contains(item[0]))
is S.true])
# Test this sub-event
if elem not in domain:
return False
# All subevents passed
return True
def as_boolean(self):
return And(*[domain.as_boolean() for domain in self.domains])
[docs]def random_symbols(expr):
"""
Returns all RandomSymbols within a SymPy Expression.
"""
try:
return list(expr.atoms(RandomSymbol))
except AttributeError:
return []
[docs]def pspace(expr):
"""
Returns the underlying Probability Space of a random expression.
For internal use.
Examples
========
>>> from sympy.stats import pspace, Normal
>>> from sympy.stats.rv import ProductPSpace
>>> X = Normal('X', 0, 1)
>>> pspace(2*X + 1) == X.pspace
True
"""
expr = sympify(expr)
rvs = random_symbols(expr)
if not rvs:
raise ValueError("Expression containing Random Variable expected, not %s" % (expr))
# If only one space present
if all(rv.pspace == rvs[0].pspace for rv in rvs):
return rvs[0].pspace
# Otherwise make a product space
return ProductPSpace(*[rv.pspace for rv in rvs])
def sumsets(sets):
"""
Union of sets
"""
return frozenset().union(*sets)
[docs]def rs_swap(a, b):
"""
Build a dictionary to swap RandomSymbols based on their underlying symbol.
i.e.
if ``X = ('x', pspace1)``
and ``Y = ('x', pspace2)``
then ``X`` and ``Y`` match and the key, value pair
``{X:Y}`` will appear in the result
Inputs: collections a and b of random variables which share common symbols
Output: dict mapping RVs in a to RVs in b
"""
d = {}
for rsa in a:
d[rsa] = [rsb for rsb in b if rsa.symbol == rsb.symbol][0]
return d
[docs]def given(expr, condition=None, **kwargs):
""" Conditional Random Expression
From a random expression and a condition on that expression creates a new
probability space from the condition and returns the same expression on that
conditional probability space.
Examples
========
>>> from sympy.stats import given, density, Die
>>> X = Die('X', 6)
>>> Y = given(X, X > 3)
>>> density(Y).dict
{4: 1/3, 5: 1/3, 6: 1/3}
Following convention, if the condition is a random symbol then that symbol
is considered fixed.
>>> from sympy.stats import Normal
>>> from sympy import pprint
>>> from sympy.abc import z
>>> X = Normal('X', 0, 1)
>>> Y = Normal('Y', 0, 1)
>>> pprint(density(X + Y, Y)(z), use_unicode=False)
2
-(-Y + z)
-----------
___ 2
\/ 2 *e
------------------
____
2*\/ pi
"""
if not random_symbols(condition) or pspace_independent(expr, condition):
return expr
if isinstance(condition, RandomSymbol):
condition = Eq(condition, condition.symbol)
condsymbols = random_symbols(condition)
if (isinstance(condition, Equality) and len(condsymbols) == 1 and
not isinstance(pspace(expr).domain, ConditionalDomain)):
rv = tuple(condsymbols)[0]
results = solveset(condition, rv)
if isinstance(results, Intersection) and S.Reals in results.args:
results = list(results.args[1])
return sum(expr.subs(rv, res) for res in results)
# Get full probability space of both the expression and the condition
fullspace = pspace(Tuple(expr, condition))
# Build new space given the condition
space = fullspace.conditional_space(condition, **kwargs)
# Dictionary to swap out RandomSymbols in expr with new RandomSymbols
# That point to the new conditional space
swapdict = rs_swap(fullspace.values, space.values)
# Swap random variables in the expression
expr = expr.xreplace(swapdict)
return expr
def expectation(expr, condition=None, numsamples=None, evaluate=True, **kwargs):
"""
Returns the expected value of a random expression
Parameters
==========
expr : Expr containing RandomSymbols
The expression of which you want to compute the expectation value
given : Expr containing RandomSymbols
A conditional expression. E(X, X>0) is expectation of X given X > 0
numsamples : int
Enables sampling and approximates the expectation with this many samples
evalf : Bool (defaults to True)
If sampling return a number rather than a complex expression
evaluate : Bool (defaults to True)
In case of continuous systems return unevaluated integral
Examples
========
>>> from sympy.stats import E, Die
>>> X = Die('X', 6)
>>> E(X)
7/2
>>> E(2*X + 1)
8
>>> E(X, X > 3) # Expectation of X given that it is above 3
5
"""
if not random_symbols(expr): # expr isn't random?
return expr
if numsamples: # Computing by monte carlo sampling?
return sampling_E(expr, condition, numsamples=numsamples)
# Create new expr and recompute E
if condition is not None: # If there is a condition
return expectation(given(expr, condition), evaluate=evaluate)
# A few known statements for efficiency
if expr.is_Add: # We know that E is Linear
return Add(*[expectation(arg, evaluate=evaluate)
for arg in expr.args])
# Otherwise case is simple, pass work off to the ProbabilitySpace
result = pspace(expr).integrate(expr)
if evaluate and hasattr(result, 'doit'):
return result.doit(**kwargs)
else:
return result
def probability(condition, given_condition=None, numsamples=None,
evaluate=True, **kwargs):
"""
Probability that a condition is true, optionally given a second condition
Parameters
==========
condition : Combination of Relationals containing RandomSymbols
The condition of which you want to compute the probability
given_condition : Combination of Relationals containing RandomSymbols
A conditional expression. P(X > 1, X > 0) is expectation of X > 1
given X > 0
numsamples : int
Enables sampling and approximates the probability with this many samples
evaluate : Bool (defaults to True)
In case of continuous systems return unevaluated integral
Examples
========
>>> from sympy.stats import P, Die
>>> from sympy import Eq
>>> X, Y = Die('X', 6), Die('Y', 6)
>>> P(X > 3)
1/2
>>> P(Eq(X, 5), X > 2) # Probability that X == 5 given that X > 2
1/4
>>> P(X > Y)
5/12
"""
condition = sympify(condition)
given_condition = sympify(given_condition)
if given_condition is not None and \
not isinstance(given_condition, (Relational, Boolean)):
raise ValueError("%s is not a relational or combination of relationals"
% (given_condition))
if given_condition == False:
return S.Zero
if not isinstance(condition, (Relational, Boolean)):
raise ValueError("%s is not a relational or combination of relationals"
% (condition))
if condition is S.true:
return S.One
if condition is S.false:
return S.Zero
if numsamples:
return sampling_P(condition, given_condition, numsamples=numsamples,
**kwargs)
if given_condition is not None: # If there is a condition
# Recompute on new conditional expr
return probability(given(condition, given_condition, **kwargs), **kwargs)
# Otherwise pass work off to the ProbabilitySpace
result = pspace(condition).probability(condition, **kwargs)
if evaluate and hasattr(result, 'doit'):
return result.doit()
else:
return result
class Density(Basic):
expr = property(lambda self: self.args[0])
@property
def condition(self):
if len(self.args) > 1:
return self.args[1]
else:
return None
def doit(self, evaluate=True, **kwargs):
expr, condition = self.expr, self.condition
if condition is not None:
# Recompute on new conditional expr
expr = given(expr, condition, **kwargs)
if not random_symbols(expr):
return Lambda(x, DiracDelta(x - expr))
if (isinstance(expr, RandomSymbol) and
hasattr(expr.pspace, 'distribution') and
isinstance(pspace(expr), SinglePSpace)):
return expr.pspace.distribution
result = pspace(expr).compute_density(expr, **kwargs)
if evaluate and hasattr(result, 'doit'):
return result.doit()
else:
return result
[docs]def density(expr, condition=None, evaluate=True, numsamples=None, **kwargs):
"""
Probability density of a random expression, optionally given a second
condition.
This density will take on different forms for different types of
probability spaces. Discrete variables produce Dicts. Continuous
variables produce Lambdas.
Parameters
==========
expr : Expr containing RandomSymbols
The expression of which you want to compute the density value
condition : Relational containing RandomSymbols
A conditional expression. density(X > 1, X > 0) is density of X > 1
given X > 0
numsamples : int
Enables sampling and approximates the density with this many samples
Examples
========
>>> from sympy.stats import density, Die, Normal
>>> from sympy import Symbol
>>> x = Symbol('x')
>>> D = Die('D', 6)
>>> X = Normal(x, 0, 1)
>>> density(D).dict
{1: 1/6, 2: 1/6, 3: 1/6, 4: 1/6, 5: 1/6, 6: 1/6}
>>> density(2*D).dict
{2: 1/6, 4: 1/6, 6: 1/6, 8: 1/6, 10: 1/6, 12: 1/6}
>>> density(X)(x)
sqrt(2)*exp(-x**2/2)/(2*sqrt(pi))
"""
if numsamples:
return sampling_density(expr, condition, numsamples=numsamples,
**kwargs)
return Density(expr, condition).doit(evaluate=evaluate, **kwargs)
def cdf(expr, condition=None, evaluate=True, **kwargs):
"""
Cumulative Distribution Function of a random expression.
optionally given a second condition
This density will take on different forms for different types of
probability spaces.
Discrete variables produce Dicts.
Continuous variables produce Lambdas.
Examples
========
>>> from sympy.stats import density, Die, Normal, cdf
>>> from sympy import Symbol
>>> D = Die('D', 6)
>>> X = Normal('X', 0, 1)
>>> density(D).dict
{1: 1/6, 2: 1/6, 3: 1/6, 4: 1/6, 5: 1/6, 6: 1/6}
>>> cdf(D)
{1: 1/6, 2: 1/3, 3: 1/2, 4: 2/3, 5: 5/6, 6: 1}
>>> cdf(3*D, D > 2)
{9: 1/4, 12: 1/2, 15: 3/4, 18: 1}
>>> cdf(X)
Lambda(_z, -erfc(sqrt(2)*_z/2)/2 + 1)
"""
if condition is not None: # If there is a condition
# Recompute on new conditional expr
return cdf(given(expr, condition, **kwargs), **kwargs)
# Otherwise pass work off to the ProbabilitySpace
result = pspace(expr).compute_cdf(expr, **kwargs)
if evaluate and hasattr(result, 'doit'):
return result.doit()
else:
return result
[docs]def where(condition, given_condition=None, **kwargs):
"""
Returns the domain where a condition is True.
Examples
========
>>> from sympy.stats import where, Die, Normal
>>> from sympy import symbols, And
>>> D1, D2 = Die('a', 6), Die('b', 6)
>>> a, b = D1.symbol, D2.symbol
>>> X = Normal('x', 0, 1)
>>> where(X**2<1)
Domain: And(-1 < x, x < 1)
>>> where(X**2<1).set
(-1, 1)
>>> where(And(D1<=D2 , D2<3))
Domain: Or(And(Eq(a, 1), Eq(b, 1)), And(Eq(a, 1), Eq(b, 2)), And(Eq(a, 2), Eq(b, 2))) """
if given_condition is not None: # If there is a condition
# Recompute on new conditional expr
return where(given(condition, given_condition, **kwargs), **kwargs)
# Otherwise pass work off to the ProbabilitySpace
return pspace(condition).where(condition, **kwargs)
[docs]def sample(expr, condition=None, **kwargs):
"""
A realization of the random expression
Examples
========
>>> from sympy.stats import Die, sample
>>> X, Y, Z = Die('X', 6), Die('Y', 6), Die('Z', 6)
>>> die_roll = sample(X + Y + Z) # A random realization of three dice
"""
return next(sample_iter(expr, condition, numsamples=1))
[docs]def sample_iter(expr, condition=None, numsamples=S.Infinity, **kwargs):
"""
Returns an iterator of realizations from the expression given a condition
expr: Random expression to be realized
condition: A conditional expression (optional)
numsamples: Length of the iterator (defaults to infinity)
Examples
========
>>> from sympy.stats import Normal, sample_iter
>>> X = Normal('X', 0, 1)
>>> expr = X*X + 3
>>> iterator = sample_iter(expr, numsamples=3)
>>> list(iterator) # doctest: +SKIP
[12, 4, 7]
See Also
========
Sample
sampling_P
sampling_E
sample_iter_lambdify
sample_iter_subs
"""
# lambdify is much faster but not as robust
try:
return sample_iter_lambdify(expr, condition, numsamples, **kwargs)
# use subs when lambdify fails
except TypeError:
return sample_iter_subs(expr, condition, numsamples, **kwargs)
def sample_iter_lambdify(expr, condition=None, numsamples=S.Infinity, **kwargs):
"""
See sample_iter
Uses lambdify for computation. This is fast but does not always work.
"""
if condition:
ps = pspace(Tuple(expr, condition))
else:
ps = pspace(expr)
rvs = list(ps.values)
fn = lambdify(rvs, expr, **kwargs)
if condition:
given_fn = lambdify(rvs, condition, **kwargs)
# Check that lambdify can handle the expression
# Some operations like Sum can prove difficult
try:
d = ps.sample() # a dictionary that maps RVs to values
args = [d[rv] for rv in rvs]
fn(*args)
if condition:
given_fn(*args)
except Exception:
raise TypeError("Expr/condition too complex for lambdify")
def return_generator():
count = 0
while count < numsamples:
d = ps.sample() # a dictionary that maps RVs to values
args = [d[rv] for rv in rvs]
if condition: # Check that these values satisfy the condition
gd = given_fn(*args)
if gd != True and gd != False:
raise ValueError(
"Conditions must not contain free symbols")
if not gd: # If the values don't satisfy then try again
continue
yield fn(*args)
count += 1
return return_generator()
def sample_iter_subs(expr, condition=None, numsamples=S.Infinity, **kwargs):
"""
See sample_iter
Uses subs for computation. This is slow but almost always works.
"""
if condition is not None:
ps = pspace(Tuple(expr, condition))
else:
ps = pspace(expr)
count = 0
while count < numsamples:
d = ps.sample() # a dictionary that maps RVs to values
if condition is not None: # Check that these values satisfy the condition
gd = condition.xreplace(d)
if gd != True and gd != False:
raise ValueError("Conditions must not contain free symbols")
if not gd: # If the values don't satisfy then try again
continue
yield expr.xreplace(d)
count += 1
def sampling_P(condition, given_condition=None, numsamples=1,
evalf=True, **kwargs):
"""
Sampling version of P
See Also
========
P
sampling_E
sampling_density
"""
count_true = 0
count_false = 0
samples = sample_iter(condition, given_condition,
numsamples=numsamples, **kwargs)
for x in samples:
if x != True and x != False:
raise ValueError("Conditions must not contain free symbols")
if x:
count_true += 1
else:
count_false += 1
result = S(count_true) / numsamples
if evalf:
return result.evalf()
else:
return result
def sampling_E(expr, given_condition=None, numsamples=1,
evalf=True, **kwargs):
"""
Sampling version of E
See Also
========
P
sampling_P
sampling_density
"""
samples = sample_iter(expr, given_condition,
numsamples=numsamples, **kwargs)
result = Add(*list(samples)) / numsamples
if evalf:
return result.evalf()
else:
return result
def sampling_density(expr, given_condition=None, numsamples=1, **kwargs):
"""
Sampling version of density
See Also
========
density
sampling_P
sampling_E
"""
results = {}
for result in sample_iter(expr, given_condition,
numsamples=numsamples, **kwargs):
results[result] = results.get(result, 0) + 1
return results
def dependent(a, b):
"""
Dependence of two random expressions
Two expressions are independent if knowledge of one does not change
computations on the other.
Examples
========
>>> from sympy.stats import Normal, dependent, given
>>> from sympy import Tuple, Eq
>>> X, Y = Normal('X', 0, 1), Normal('Y', 0, 1)
>>> dependent(X, Y)
False
>>> dependent(2*X + Y, -Y)
True
>>> X, Y = given(Tuple(X, Y), Eq(X + Y, 3))
>>> dependent(X, Y)
True
See Also
========
independent
"""
if pspace_independent(a, b):
return False
z = Symbol('z', real=True)
# Dependent if density is unchanged when one is given information about
# the other
return (density(a, Eq(b, z)) != density(a) or
density(b, Eq(a, z)) != density(b))
def independent(a, b):
"""
Independence of two random expressions
Two expressions are independent if knowledge of one does not change
computations on the other.
Examples
========
>>> from sympy.stats import Normal, independent, given
>>> from sympy import Tuple, Eq
>>> X, Y = Normal('X', 0, 1), Normal('Y', 0, 1)
>>> independent(X, Y)
True
>>> independent(2*X + Y, -Y)
False
>>> X, Y = given(Tuple(X, Y), Eq(X + Y, 3))
>>> independent(X, Y)
False
See Also
========
dependent
"""
return not dependent(a, b)
def pspace_independent(a, b):
"""
Tests for independence between a and b by checking if their PSpaces have
overlapping symbols. This is a sufficient but not necessary condition for
independence and is intended to be used internally.
Notes
=====
pspace_independent(a, b) implies independent(a, b)
independent(a, b) does not imply pspace_independent(a, b)
"""
a_symbols = set(pspace(b).symbols)
b_symbols = set(pspace(a).symbols)
if len(a_symbols.intersection(b_symbols)) == 0:
return True
return None
def rv_subs(expr, symbols=None):
"""
Given a random expression replace all random variables with their symbols.
If symbols keyword is given restrict the swap to only the symbols listed.
"""
if symbols is None:
symbols = random_symbols(expr)
if not symbols:
return expr
swapdict = {rv: rv.symbol for rv in symbols}
return expr.xreplace(swapdict)
class NamedArgsMixin(object):
_argnames = ()
def __getattr__(self, attr):
try:
return self.args[self._argnames.index(attr)]
except ValueError:
raise AttributeError("'%s' object has not attribute '%s'" % (
type(self).__name__, attr))
def _value_check(condition, message):
"""
Check a condition on input value.
Raises ValueError with message if condition is not True
"""
if condition != True:
raise ValueError(message)


| lesson 48 The silent village |
| In this much-travelled world, there are still thousands of places which are inaccessible to tourists. |
| We always assume that villagers in remote places are friendly and hospitable. |
| But people who are cut off not only from foreign tourists, but even from their own countrymen can be hostile to travellers. |
| Visits to really remote villages are seldom enjoyable -- as my wife and I discovered during a tour through the Balkans. |
| We had spent several days in a small town and visited a number of old churches in the vicinity. |
| These attracted many visitors, for they were not only of great architectural interest, |
| but contained a large number of beautifully preserved frescoes as well. |
| On the day before our departure, several bus loads of tourists descended on the town. |
| This was more than we could bear, so we decided to spend our last day exploring the countryside. |
| Taking a path which led out of the town, we crossed a few fields until we came to a dense wood. |
| We expected the path to end abruptly, but we found that it traced its way through the trees. |
| We tramped through the wood for over two hours until we arrived at a deep stream. |
| We could see that the path continued on the other side, but we had no idea how we could get across the stream. |
| Suddenly my wife spotted a boat moored to the bank. |
| In it there was a boatman fast asleep. |
| We gently woke him up and asked him to ferry us to the other side. |
| Though he was reluctant to do so at first, we eventually persuaded him to take us. |
| The path led to a tiny village perched on the steep sides of a mountain. |
| The place consisted of a straggling unmade road which was lined on either side by small houses. |
| Even under a clear blue sky, the village looked forbidding, as all the houses were built of grey mud bricks. |
| The village seemed deserted, the only sign of life being an ugly-looking black goat on a short length of rope tied to a tree in a field nearby. |
| Sitting down on a dilapidated wooden fence near the field, we opened a couple of tins of sardines and had a picnic lunch. |
| All at once, I noticed that my wife seemed to be filled with alarm. |
| Looking up I saw that we were surrounded by children in rags who were looking at us silently as we ate. |
| We offered them food and spoke to them kindly, but they remained motionless. |
| I concluded that they were simply shy of strangers. |
| When we later walked down the main street of the village, we were followed by a silent procession of children. |
| The village which had seemed deserted, immediately came to life. |
| Faces appeared at windows. |
| Men in shirt sleeves stood outside their houses and glared at us. |
| Old women in black shawls peered at us from doorways. |
| The most frightening thing of all was that not a sound could be heard. |
| There was no doubt that we were unwelcome visitors. |
| We needed no further warning. |
| Turning back down the main street, we quickened our pace and made our way rapidly towards the stream where we hoped the boatman was waiting. |


What is Ruby on Rails?
Saturday, September 27, 2014
For this post I chose to write a bit about Rails (short for "Ruby on Rails") because I've heard many good things about it and it's something that I'll be learning at Dev Bootcamp. I'm curious to know why the tech industry loves it so much, why Dev Bootcamp teaches it, and how it might be useful to me as an aspiring software developer.
First, what is Ruby? Ruby is a popular general-purpose programming language that is best known for web programming. Ruby on Rails is essentially a software library that extends the Ruby programming language. Rails is installed from the command-line using what are called called "RubyGems". Using Rails developers can organize and create all the files necessary to run a complex website.
What's so good about Rails?
There are a few guiding principals behind Rails that make Rails such an easy framework to work with for web development.
- Rails is opinionated which means there is a "Rails Way" of doing things. As a developer this is a good thing because you'll have fewer decisions to make which results in faster development and easier maintenance.
- Rails uses Convention Over Configuration. This relates to the previous point about Ruby being opinionated. There are conventional ways of doing things in Rails that make it easier for developers. For example developers don't have to spend time setting up configuration files and choosing names to assign files. This makes collaboration easier since other developers have learned the same conventions.
- Don't Repeat Yourself (DRY). Rails avoids duplication of code. Duplication results in more complex programs that are difficult to maintain and debug.
Why do programming bootcamps such as DBC, focus on Rails?
One of the co-founders of DBC, Jesse Farmer, wrote a great answer to this question on
Quora. DBC teaches Rails over other web development frameworks because Rails is more welcoming to beginners. He also downplayed the importance of focusing on a particular programming framework such as Rails because it is more important for beginners to learn the fundamental, unchanging aspects of programming since the technology is always changing.
While I haven't spent much time with Rails yet, I'm looking forward to learning it. It seems a lot less complicated than other web development frameworks, and I'll be able to create awesome full-featured websites.
Resources


CIT 230 - Assignment Portal.
- Lesson 3: HTML Markup Validation Assignment
- Lesson 4: The Weather Today - Franklin HTML Page
- Lesson 5: The Weather Today - Franklin HTML Page
- Lesson 6: The Weather Today - Franklin HTML Page Responsive
- Lesson 7: The Weather Today - Franklin HTML Display Flex and Grid
- Lesson 8: The Weather Today - Table Build
- Lesson 8: The Weather Today - Storm Center
- Lesson 9: Heroes - JSON Practice
- Lesson 9: The Weather Today - Main Site
- Lesson 10: The Weather Today - Main Site
- Lesson 11: Lesson 2 - Index
- Lesson 11: Lesson 3 - Index
- Lesson 11: Lesson 4 - Index
- Lesson 11: Lesson 5 - ClickBox
- Lesson 12-14: Term Web Site


new Connection(url, request)
Creates a Connection to a CouchDB Instance.
| Name | Type | Description |
|---|---|---|
url |
string |
The base URL to the CouchDB Instance |
request |
object |
An object supporting the 'request' interface |
Methods
-
make_request(method, path, opts){Promise}
-
The central workhorse for performing the HTTP requests. The 'opts' parameter can contain the following optional data:
- parms: An Object of key value pairs to be appended to the URL
- headers: An Object of key value pairs to be put into the request headers
- body: An Object or Array to be JSON encoded into the request body
Name Type Description method
string The HTTP verb to be used in the request
path
string The relative path for the request
opts
Object An Object containing optional parameters for the request
Returns:
promise object either resolving into a {Couch


Startup System
Complete your character and get ready for our world!
You can't be seen, invisible mode is activated.
You can't move until you complete startup system.
PvP Zone!
Move To Main Town!


model.pieces.types
Interfaces
MovementPattern
Classes
BishopPattern
JumpingPattern
KnightPattern
LinePattern
MultiPattern
PawnPattern
QueenPattern
RookPattern
SimplifiedKingPattern


© Robert Clewley, August 2004 version.
This document describes three Matlab utilities that provide an elementary interface between Matlab and Bard Ermentrout’s XPP software. They have been tested on Linux and Windows platforms, but not yet on Macs. There should be no problem using these functions on Macs, but please let me know if there are. I have assumed the name of the XPP command in Mac OS is xppaut. If this is not the case on your computer then the command string can be passed explicitly to the Matlab function that calls XPP (see below).
The principal use of the utilities is to run large batch jobs which involve several range parameters, or to change parameters or initial conditions interactively with XPP as part of a numerical search algorithm. Matlab’s internal differential equation solvers are often slower than their equivalent implementations in XPP, and for large coupled systems they are less intuitive to code in my opinion. While there is some overhead involved in loading an ASCII-format simulation data file into Matlab for every XPP batch run, I have found the loss of speed a small price to pay for the added convenience. I compared XPP’s internal range facility, over two parameters, with an equivalent Matlab script that implemented the same ranges, and found that my Matlab scripts ran approximately 30% slower. (Omitting auxiliary variables from the version of the ODE file manipulated by these utilities can cut this overhead substantially.)
Additionally, these utilities provide a means to post-process XPP simulation data with any of the statistical functions built into Matlab, or your own. For instance, the included utility GetCrossings finds threshold crossings in continuous-time data (e.g. spike times in neural membrane potentials), from which spiking frequencies are easily computed. This means that less experienced XPP users may therefore find that they can interact with XPP without having to learn to write dynamically linked C library functions, or to cunningly hack “exotic” XPP solutions to their data processing needs (no offense, Bard :).
Two utilities (ChangeXPPodeFile and ChangeXPPsetFile) are designed to provide a simple way for the user to change initial conditions and parameter values of named variables and parameters in either an XPP ‘.ode’ or ‘.set’ file that you have already set up. Keeping backups of these files is very important before you let these utilities stomp all over your carefully-tuned parameter set. The values to be changed in the XPP files are set up using a Matlab structure array, which resembles a C structure array. For instance, if you wanted to change two parameters and one initial condition for an ODE, you could build the following structure array in a Matlab script. The array can be in any order, provided every entry is a structure having precisely three fields: type (string, either ‘IC’ or ‘PAR’), name (string, a valid name of a variable or parameter in the ODE file), and val (any finite real number).
mypars
|
|
mypars(1) |
mypars(2) |
mypars(3) |
|
mypars(1).type
= ‘IC’ |
mypars(2).type
= ‘PAR’ |
mypars(3).type
= ‘PAR’ |
|
mypars(1).name
= ‘x’ |
mypars(2).name
= ‘a’ |
mypars(3).name
= ‘c’ |
|
mypars(1).val
= 0.5 |
mypars(2).val
= 3.1e-5 |
mypars(3).val
= 100 |
The function RunXPP is a simple way to run XPP as a command-line executed call from within Matlab, that allows specification of a SET file or the re-seeding of the random number generator. The ODE or SET files should already be changed using the above utilities before calling RunXPP.
The final utility, GetCrossings, gives a simple method to take a loaded data set and search for threshold crossings within particular variables’ time-courses. The threshold is an argument to the function, as is the direction of threshold traversal, which is specified the same way as for the global command in XPP.
Also included is an ODE file, HH_slowNa.ode, describing a model for a Hodgkin-Huxley neuron with a slow potassium current, and a Matlab script, meshplot_example.m, for calculating the frequency response as two parameters are varied, the current drive and the slow potassium maximal conductance. The script produces a 3-dimensional plot of the frequency response surface, which is included as the file freq_mesh.fig. This script combines the use of all the included utilities, and can be used as a basis for development of your own scripts and functions. It contains numerous comments.
Finally, if you have any error reports or suggestions for development of these functions please email me.
Change parameters / initial conditions in XPP ODE file
success
= ChangeXPPodeFile(filename, parset)
ChangeXPPodeFile changes the values of the parameters and initial conditions named in the parset structure by directly modifying the named ODE file. The return value success is a boolean.
All initial conditions to be changed must be explicitly declared in the ODE file using init or i, not using the format x(0) for a variable x, etc. Also, implicitly-declared zero initial conditions cannot be altered by this function. This function has to be able to find an explicit declaration of the initial condition in order to change it. For the latter occasions, you might find it better to use the ChangeXPPsetFile function instead, along with the setfile option of RunXPP. 'number' declarations in XPP are also not supported as range parameters.
Input arguments:
filename must end with the extension '.ode'
parset is a structure array with fields type, name, and val. The type must be one of the strings 'PAR' or 'IC'.
Change parameters / initial conditions in XPP SET file
success
= ChangeXPPsetFile(filename, parset)
ChangeXPPsetFile changes the values of the parameters and initial conditions named in the parset structure by directly modifying the named SET file. The return value success is a boolean.
Input arguments:
filename should end with the extension '.set'
parset is a structure array with fields type, name, and val. The type must be one of the strings 'PAR' or 'IC'.
Run XPP in silent mode
success
= RunXPP(odeFilename, setFilename, newseed, xppname)
RunXPP runs the XPP executable that is assumed to be in the local directory on the ODE file odeFilename (with extension ‘.ode’). The optional string argument setFilename can be set to the name of a SET file which will be used by the silent runs of XPP. The optional boolean argument newseed (default is false) that signals XPP to re-seed its random number generator, for instance when running simulations involving random variables. The final, optional, argument xppname additionally specifies the name of the XPP executable file if the default name ‘xppaut’ that is assumed by RunXPP is not correct. The return value success is a boolean.
Convert simulation output data into threshold crossing times
crossings
= GetCrossings(data, threshold, maxcrossings, dirn, indices, verboseTog)
GetCrossings takes an array of simulation data with time in the first column, variables in remaining columns, and a threshold crossing value. This function detects threshold crossings in the direction given by dirn in all variables. Use dirn = -1 for decreasing threshold crossings, 1 for increasing threshold crossings. Use dirn = 0 for detection of all threshold crossings, in either direction. Linear interpolation is used to find the crossing times accurately. The optional 5th argument indices is a list of indices to select from the variable columns (when there are mixture of spiking and non-spiking variables present in the passed data set). If it is omitted, all the variable columns are searched.
The result is an array, crossings, having dimensions |indices| by maxcrossings. In each of the rows are the crossing times of each variable in the passed data set. maxcrossings is set to 100 by default if it is omitted. However, if maxcrossings is set at 0, the function returns a cell array of crossing time cell arrays, with rows of length equal to the number of crossings in the data.
The final, optional, boolean argument verboseTog controls suppression of warning messages (defaults to false).


Clover is easy to install. Just download the toolkit codes and configure the interface page. Then add the Rewrite Code to the file .htaccess
.
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [QSA,L] # For Apache2
For web request, you need to generate the controllers, models and views in certain directories, which are defined in the Clover Class and could be changed dynamically.
Then you can open your browser to link to your site with url. The url rules are as following. The part of index.php
might be neglected.
WEB_ROOT/CONTROLLER(/ACTION(/PARAM))
For CLI (designed for cronjob), the models and views are same to web request, but no controllers needed, instead commands are required.
Run script command as following.
php CloverCLI.php COMMAND ACTION --PARAM_NAME=PARAM_VALUE


Code
import webgl, dom,math,jsconsole
import ../src/sgl/[state,utils]
# Vertex shader source code
var vertCode = """
uniform mat3 rotation;
uniform mat3 projection;
attribute vec3 coordinates;
void main(void) {
gl_Position = vec4(projection*rotation*coordinates, 1.0);
}
"""
#fragment shader source code
var fragCode ="""
precision mediump float;
uniform vec4 u_color;
void main(void) {
gl_FragColor = u_color;
}
"""
let vertices = [
0.0,0,0.0,
100,0,0.0,
100,100,0.0,
100,100,0.0,
0, 100,0.0,
0, 0, 0.0
];
var lastrotation = [
1.0,0,0,
0,1,0,
0,0,1,
];
var indices = [0'u16,1,2,3,4,5];
var sgl = initstate("sgl-canvas",vertcode,fragCode)
sgl.upload(vertices,indices)
sgl.point("coordinates") # Tell webgl that the buffers we just uploaded are "coordinates"
sgl["projection"] = projection3(sgl.gl.drawingbufferwidth.float,sgl.gl.drawingbufferheight.float)
sgl["rotation"] = lastrotation # set the uniform "rotation"
sgl["u_color"] = [0.0,0,0,1] # set the uniform "u_color"
var theta = 0.0
var counter = 0
var starttime = 0.0
var fpstime = 0.0
proc draw(dt:float) =
# Loop
# FPS counter
fpstime += dt-starttime
if fpstime>1000:
console.log counter
counter = 0
fpstime = 0
# Limit to 60fps
if dt-starttime>1000/60:
starttime = dt
inc counter
# Draw the triangle
sgl.drawElementsAs(pmTriangles)
# Update rotation uniform
if rotation3(theta) != lastrotation:
sgl["rotation"] = rotation3(theta)
lastrotation = rotation3(theta)
theta+=1
# Keep looping
requestAnimationFrame(draw)
# Example binding keyboard input
proc keyev(e:dom.Event) =
if (char(e.keycode)) == 'a':
theta+=45 # rotate counterclockwise
elif (char(e.keycode)) == 'd':
theta-=45 # rotate clockwise
document.addEventlistener("keypress",keyev,true)
# Start looping
draw(0.0)


BURNT BY THE SUN A film review by Fred Kreisel Copyright 1995 Iskra Research
Stalinism Revisited
There is a new Russian film playing now in the US, and it is a must-see!
This 1995 feature film took a number of prizes at the Cannes Film Festival, and deservedly so. Nikota Mikhalkov both directed and starred in it in the role of Sergei Kotov, a Red Army officer, hero of the Civil War and a pillar of the Soviet regime.
What starts as a languorous and idyllic story describes one day in the life of a privileged family in the new Soviet Russia on a lazy Sunday in the summer of 1936, just weeks before the first of the infamous Moscow Trials broke on a stunned world. The sense of imminent danger is palpable throughout this gripping film.
Realism of this film is developed on various levels. Firstly, Mikhalkov uses vivid summer colors and a typical rural location to bring the viewer into the midst of a July countryside somewhere near Moscow. Secondly, the skilled use of choice actors: tender and talented portrayal of Kotov's six-year-old girl by Mikhalkov's own daughter, the sensuous elegance of the beautiful Ingeborga Dapkunaite as Kotov's wife, the nervous energy of Oleg Menshikov as the intruding antagonist, and so on. Thirdly, there is the masterful counterposition of quick action and peaceful periods of weekend rest.
Finally, there is the shocking reality of the Purges themselves, totally unprecedented in world history. From mid-1936 until 1939 Stalin wiped out the vast majority of the top echelons of the Soviet regime: most of the top commanders of the Red Army, the majority of the leaders of the Bolshevik Party during its heroic period of struggle for power, the leading engineers, designers and scientists, outstanding writers, artists, film and theatre directors, and so on.
Stalin's assistants in this counterrevolutionary terror directed against the organizers of Bolshevik victory and the builders of the Soviet state were in many cases individuals who resisted the October Revolution in 1917 or who stayed on the sidelines. Stalin's chief prosecutor at the Trials was Andrei Vyshinsky, a former Menshevik leader. Among the chief torturers of the NKVD was Lavrentii Beria, known to all the Caucasian revolutionaries as a tzarist agent provocateur; two of the chief stage managers of the show trials were Henrik Yagoda and Nikolai Yezhov, unknown during the Revolution and the Civil War, but promoted by Stalin in the fight against Trotsky and the Left Opposition.
Mikhalkov reaches towards an understanding of the reactionary aims of Stalinist purges. His protagonist Kotov begins to see the class basis for this genocide of the true revolutionaries at the hands of the power hungry bureaucrats and the former White Guards. However, the director's power of penetration is limited by the confusion and disorientation still prevailing in Russia. We hope that this film marks a new step in the search for the truth about the history of the Revolution led by Lenin and Trotsky, and the Stalinist counterrevolution which followed.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


The slot/slot.h
header defines the evaluated slot mechanism.
#include <chaos/preprocessor/slot/slot.h>
The CHAOS_PP_VALUE
macro is a user-defined named external argument that specifies the expression to be evaluated and assigned to a slot index.
#define CHAOS_PP_VALUE
expr
The expression that is to be evaluated.
This macro is defined by the user immediately preceding an invocation of CHAOS_PP_ASSIGN_SLOT
, which, in turn, evaluates the expression contained in CHAOS_PP_VALUE
and assigns it to a slot index.
After that assignment, CHAOS_PP_VALUE
is undefined automatically.
The CHAOS_PP_ASSIGN_SLOT
macro fully evaluates a numeric expression.
??=include CHAOS_PP_ASSIGN_SLOT
(i)
The slot index that is to be assigned.
Valid values range from 1
to CHAOS_PP_LIMIT_SLOT
.
This macro evaluates the numeric expression contained in the named external argument CHAOS_PP_VALUE
and assigns it to the i-th evaluated slot.
If CHAOS_PP_VALUE
is not defined prior to the use of this macro, it is given the default value of 0
.
The numeric expression must evaluate to a value that is 1 to CHAOS_PP_LIMIT_SLOT_VALUE
digits (base-10).
The range of the expression is also possibly constricted by the preprocessor in use.
Specifically, the preprocessor must be capable of evaluating the expression on an #if
or #elif
directive.
After CHAOS_PP_ASSIGN_SLOT
has assigned the resulting value of CHAOS_PP_VALUE
to the i-th evaluated slot, it undefines CHAOS_PP_VALUE
.
#include<chaos/preprocessor/slot/slot.h>
#defineCHAOS_PP_VALUE
1 + 2 + 3 ??=includeCHAOS_PP_ASSIGN_SLOT
(1)CHAOS_PP_SLOT
(1) // 6
The CHAOS_PP_ASSIGN_SLOT_ID
macro indirectly expands to CHAOS_PP_ASSIGN_SLOT
.
CHAOS_PP_ASSIGN_SLOT_ID
()
This macro exists only for uniformity with other macros that require indirect invocation.
The CHAOS_PP_ASSIGN_SLOT_
macro expands to a λ expression representing CHAOS_PP_ASSIGN_SLOT
.
CHAOS_PP_ASSIGN_SLOT_
This macro is a shorthand form of the following λ binding:
The CHAOS_PP_SLOT
macro retrieves a value previously evaluated by CHAOS_PP_ASSIGN_SLOT
.
CHAOS_PP_SLOT
(i)
The slot index of the value that is to be retrieved.
Valid values range from 1
to CHAOS_PP_LIMIT_SLOT
.
This macro retrieves the value that was previously assigned to the slot index i.
If the slot index specified by i has never been assigned, this macro expands to 0
.
#include<chaos/preprocessor/slot/slot.h>
#define X() 4 #defineCHAOS_PP_VALUE
1 + 2 + 3 + X() ??=includeCHAOS_PP_ASSIGN_SLOT
(1) #undef XCHAOS_PP_SLOT
(1) // 10 #defineCHAOS_PP_VALUE
CHAOS_PP_SLOT
(1) *CHAOS_PP_SLOT
(1) ??=includeCHAOS_PP_ASSIGN_SLOT
(1)CHAOS_PP_SLOT
(1) // 100
The CHAOS_PP_SLOT_ID
macro indirectly expands to CHAOS_PP_SLOT
.
CHAOS_PP_SLOT_ID
()
This macro exists only for uniformity with other macros that require indirect invocation.
The CHAOS_PP_SLOT_
macro expands to a λ expression representing CHAOS_PP_SLOT
.
CHAOS_PP_SLOT_
This macro is a shorthand form of the following λ binding:


Create a CodeHut account!
One account for everything tech related,
learn more
Full Name
Email
Username
Password
Repeat Password
I hereby agree to the terms and conditions of this
service!
Sign Up!
Sign in!


Thessaloniki, Greece offers students to experience the home of many great musicians, artist, poets, and thinkers. With some of the most beautiful sights, Greece offeres many breathtaking experiences. While there, teams work with many sponsors on agriculture issues, environemntal studies, and tourist research.
Group Members: Whitney Jeanne Hazard, Casey Marie Magrath, Anushrot Mohanty, Tess E Nogueira
Wine tourism is a rapidly expanding yet nascent industry in Northern Greece. Despite extensive research on consumer segmentation, the motivations of the market, and the actions of small-medium scale wineries to reach their target consumer, inadequate information exists on the connections of these wineries and organizations involved in wine tourism. This project will expand on the existing knowledge and understanding of issues related to alternative (eno)tourism and sustainable rural development for the American Farm School in Thessaloniki, Greece.
ViewGroup Members: Devon Bray, Alexandra M Burr, Erin P Esco, Lily Marie Ouellette
The economic crisis currently in Greece has led to adverse health impacts as people are more frequently choosing inexpensive foods over fresh vegetables. We evaluated balcony hydroponics within Thessaloniki, in collaboration with Dr. Athanasios Gertsis of Perrotis College. Utilizing an iterative, human-centered design approach, we devised three hydroponic systems that are cost, time and space efficient.
View


ABOUT ME
My name is Niharikaa. I am professional Trainer.I'm very much Passionate to share my knowledge and skills to students.I'm very interested to upgrade my skills and knowledge.Trained more than 2000 Students so far in my experience.Good in Technical Knowledge and as well as in delivering the content in an interesting manner.


10
1 Woe to those who enact unjust laws and institute unfair decrees.
2 They deprive the needy of justice, rob the poor of my people of their rights,
plunder widows, and make the fatherless their prey!
3 What will you do on judgment day when the destruction comes from far away?
To whom will you flee for
help, and where will you leave your wealth?
4 Nothing remains, and you crouch among the prisoners or fall among the killed.
For all this Yahweh's anger does not subside,
but his hand is still raised to strike.
5 Woe to the Assyrian, the club of my anger, the rod by whom I wield my fury!
6 I send him against an arrogant nation and against the people who bear my overflowing wrath.
I order him to take the spoil,
to take the prey, and to trample them like mud in the streets.
7 But this is not what he intends, nor does he think this way.
It is in his heart to destroy and eliminate many nations.
8 For he says, "Are not all my princes kings?
9 Is not Calno like Carchemish?
Is not Hamath like Arpad? Is not Samaria like Damascus?
10 As my hand has overcome idolatrous kingdoms, whose carved figures were greater than those of Jerusalem and Samaria,
11 just as I did to Samaria and her worthless idols,
will I not also do the same to Jerusalem and to her idols?"
12 When the Lord has finished his work on Mount Zion and on Jerusalem, he will speak: "I will punish the speech of the arrogant heart of the king of Assyria and his prideful looks."
13 For he says,
"By my strength and by my wisdom I acted. I have understanding,
and I have removed the boundaries of the peoples.
None fluttered their wings or opened their mouth or chirped."
15 Will the ax boast about itself against the one who wields it? Will the saw praise itself more than the one who cuts with it?
It as if a rod could lift up those who raise it, or as if a wooden club could lift up a person.
16 Therefore the Lord Yahweh of hosts will send emaciation among his elite warriors;
and under his glory there will be kindled a burning like fire.
17 The light of Israel will become a fire, and her Holy One a flame;
it will burn and devour his thorns and briers in one day.
18 Yahweh will consume the glory of his forest and of his fruitful land, both soul and body;
it will be like when a sick man's life wastes away.
19 The remnant of the trees of his forest will be so few, that a child could count them.
20 On that day, the remnant of Israel, the family of Jacob that has escaped, will no longer rely on the one who defeated them, but will indeed depend on Yahweh, the Holy One of Israel.
21 A remnant of Jacob will return to the mighty God.
22 For though your people, Israel, are like the sand of the seashore, only a remnant of them will return. Destruction is decreed, as overflowing righteousness demands.
23 For the Lord Yahweh of hosts, is about to carry out the destruction determined throughout the land.
24 Therefore the Lord Yahweh of hosts says, "My people who live in Zion, do not fear the Assyrian. He will strike you with the rod and raise his staff against you, as the Egyptians did.
25 Do not fear him, for in a very short time my anger against you will end, and my anger will lead to his destruction."
26 Then Yahweh of hosts will wield a whip against them, as when he defeated Midian at the rock of Oreb. He will raise his rod over the sea and lift it up as he did in Egypt.
27 On that day,
his burden is lifted from your shoulder and his yoke from off your neck,
and the yoke will be destroyed, because your neck will be too fat for it.
28 The enemy has come to Aiath
and has passed through Migron; at Michmash he has stored his provisions.
29 They have crossed over the pass and they lodge at Geba.
Ramah trembles and Gibeah of Saul has fled.
30 Cry aloud, daughter of Gallim! Give attention, Laishah!
You poor Anathoth!
31 Madmenah is fleeing,
and the inhabitants of Gebim run for safety.
32 This very day he will halt
at Nob and shake his fist at the mount of the daughter of Zion, the hill of Jerusalem.
33 Behold, the Lord Yahweh of hosts will lop off the boughs with a terrifying crash;
the tallest trees will be cut down, and the lofty will be brought low.
34 He will chop down the thickets of the forest with an ax, and Lebanon in his majesty will fall.


Every SharePoint noob knows that one can create list lookup
relationships, like specifying that a book belongs in a specific
bookshelf.
What I didn't know until today is SharePoint 2010 supports "reverse
lookup" out of the box!
What's Lookup?
Consider this.You have 2 lists in your SharePoint site - one that
contains books, and one that contains bookshelves:
You now create a lookup column in the "Books" list that contains the
bookshelf that the book belongs to. That's easy:
And now you can easily see where every book belongs to, and you have
nice options such as "data integrity enforcement" (not allowing books to
remain in a deleted bookshelf) and "linked columns" (adding additional
bookshelf-related data to the book list based on the relevant
bookshelf)
What's reverse Lookup?
After you finisehd writing your library contents into SharePoint, you
want to see all of the books belonging to each bookshelf.
A tried and true idea is to filter the book list using the bookshelf
column, like this:
Which is fine, but very troublesome. I wanted the exact opposite of lookup - the ability to view from every bookshelf item the matching books!
My original idea
My original plan was to create a custom field type that contains no data
and has a list-viewing webpart in its display mode that shows the
referencing items from the child list (the book list in our case). I was
halfway done when I thought about how to call my blog post, and decided
to Google that before making any further progress.
For the curious ones, I was trying to find out how to add field
parameters (such as "allow multiple selections") for my custom field.
The Solution
I stumbled upon some articles announcing that such a thing exists in
SharePoint 2010 OOTB but didn't mention where it's located. So I started
exploring, and found it! It's called "Related List" under "Insert". For
our example, I'll add a webpart showing the books contained in the shelf
in the shelf list's item display form:
You can now customize the webpart in any normal way, and the best thing
- it's not breaking the form in any way (you can still customize field
display etc. thorough the setting pages).
The end result looks like that:
Enjoy your 2-way lookup!


QOpenGLVertexArrayObject Class
The QOpenGLVertexArrayObject class wraps an OpenGL Vertex Array Object. More...
| Header: | #include <QOpenGLVertexArrayObject> |
| qmake: | QT += gui |
| Since: | Qt 5.1 |
| Inherits: | QObject |
Public Types
| class | Binder |
Public Functions
| QOpenGLVertexArrayObject(QObject *parent = Q_NULLPTR) | |
| ~QOpenGLVertexArrayObject() | |
| void | bind() |
| bool | create() |
| void | destroy() |
| bool | isCreated() const |
| GLuint | objectId() const |
| void | release() |
- 32 public functions inherited from QObject
Additional Inherited Members
- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 2 signals inherited from QObject
- 1 public variable inherited from QObject
- 10 static public members inherited from QObject
- 9 protected functions inherited from QObject
- 2 protected variables inherited from QObject
Detailed Description
The QOpenGLVertexArrayObject class wraps an OpenGL Vertex Array Object.
A Vertex Array Object (VAO) is an OpenGL container object that encapsulates the state needed to specify per-vertex attribute data to the OpenGL pipeline. To put it another way, a VAO remembers the states of buffer objects (see QOpenGLBuffer) and their associated state (e.g. vertex attribute divisors). This allows a very easy and efficient method of switching between OpenGL buffer states for rendering different "objects" in a scene. The QOpenGLVertexArrayObject class is a thin wrapper around an OpenGL VAO.
For the desktop, VAOs are supported as a core feature in OpenGL 3.0 or newer and by the GL_ARB_vertex_array_object for older versions. On OpenGL ES 2, VAOs are provided by the optional GL_OES_vertex_array_object extension. You can check the version of OpenGL with QOpenGLContext::surfaceFormat() and check for the presence of extensions with QOpenGLContext::hasExtension().
As with the other Qt OpenGL classes, QOpenGLVertexArrayObject has a create() function to create the underlying OpenGL object. This is to allow the developer to ensure that there is a valid current OpenGL context at the time.
Once you have successfully created a VAO the typical usage pattern is:
- In scene initialization function, for each visual object:
- Bind the VAO
- Set vertex data state for this visual object (vertices, normals, texture coordinates etc.)
- Unbind (release()) the VAO
- In render function, for each visual object:
- Bind the VAO (and shader program if needed)
- Call a glDraw*() function
- Unbind (release()) the VAO
The act of binding the VAO in the render function has the effect of restoring all of the vertex data state setup in the initialization phase. In this way we can set a great deal of state when setting up a VAO and efficiently switch between state sets of objects to be rendered. Using VAOs also allows the OpenGL driver to amortise the validation checks of the vertex data.
Note: Vertex Array Objects, like all other OpenGL container objects, are specific to the context for which they were created and cannot be shared amongst a context group.
See also QOpenGLVertexArrayObject::Binder and QOpenGLBuffer.
Member Function Documentation
QOpenGLVertexArrayObject::QOpenGLVertexArrayObject(QObject *parent = Q_NULLPTR)
Creates a QOpenGLVertexArrayObject with the given parent. You must call create() with a valid OpenGL context before using.
QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject()
Destroys the QOpenGLVertexArrayObject and the underlying OpenGL resource.
void QOpenGLVertexArrayObject::bind()
Binds this vertex array object to the OpenGL binding point. From this point on and until release() is called or another vertex array object is bound, any modifications made to vertex data state are stored inside this vertex array object.
If another vertex array object is then bound you can later restore the set of state associated with this object by calling bind() on this object once again. This allows efficient changes between vertex data states in rendering functions.
bool QOpenGLVertexArrayObject::create()
Creates the underlying OpenGL vertex array object. There must be a valid OpenGL context that supports vertex array objects current for this function to succeed.
Returns true
if the OpenGL vertex array object was successfully created.
When the return value is false
, vertex array object support is not available. This is not an error: on systems with OpenGL 2.x or OpenGL ES 2.0 vertex array objects may not be supported. The application is free to continue execution in this case, but it then has to be prepared to operate in a VAO-less manner too. This means that instead of merely calling bind(), the value of isCreated() must be checked and the vertex arrays has to be initialized in the traditional way when there is no vertex array object present.
See also isCreated().
void QOpenGLVertexArrayObject::destroy()
Destroys the underlying OpenGL vertex array object. There must be a valid OpenGL context that supports vertex array objects current for this function to succeed.
bool QOpenGLVertexArrayObject::isCreated() const
Returns true
is the underlying OpenGL vertex array object has been created. If this returns true
and the associated OpenGL context is current, then you are able to bind() this object.
GLuint QOpenGLVertexArrayObject::objectId() const
Returns the id of the underlying OpenGL vertex array object.
void QOpenGLVertexArrayObject::release()
Unbinds this vertex array object by binding the default vertex array object (id = 0).


{% extends "layout.html" %} {% block title %}LostTime - Series Result{% endblock %} {% block pagetitle %}
Series standings will be calculated for each class (row), using only results from the indicated events.
| Class | {% for e in events %}{{e.name}} | {% endfor %}|
|---|---|---|
| {{scevents['name']}} ({{sc}}) select all | {% for e in events %} {% if scevents[e.id] != False %}{% else %} | n/a | {% endif %} {% endfor %}
| {{stcevents['name']}} ({{stc}}) select all | {% for e in events %} {% if stcevents[e.id] != False %}{% else %} | n/a | {% endif %} {% endfor %}
Calculate series score as the of the best event scores.
An entry must have at least valid event score(s) for a valid series score.
Tie series scores are awarded


| Created By | {{ expense.user }} |
|---|---|
| Amount | {{ expense.amount }} DKK |
| Chain | {{ expense.creditor.chain.name }} |
| Creditor | {{ expense.creditor.name }} |
| Invoice Date | {{ expense.invoice_date }} |
| Description | {{ expense.description }} |
| Paid by BornHack? | This expense was paid by {% if expense.paid_by_bornhack %}BornHack{% else %}{{ expense.user }}, and will be reimbursed when approved.{% endif %} |
| Filename | {{ expense.invoice }} |
| Approved? | {{ expense.approval_status }} |
| Reimbursement? | {% if expense.reimbursement %} {% if request.resolver_match.app_name == "backoffice" %} {{ expense.reimbursement.pk }} {% else %} {{ expense.reimbursement.pk }} {% endif %} {% else %} N/A {% endif %} |
| Invoice |
Filename: {{ expense.invoice_filename }} |
| Economy Team Notes | {{ expense.notes|default:"N/A" }} |


This page tracks the new paper links made to my list of Graphics Interface 2006 papers.
Page maintained by Ke-Sen Huang. If you have additions or changes, send an e-mail.


Results
`
Click here to go back and upload more images.
{% for p in pack %}
Name
Probability(%)
{% for key,value in p.result.items() %}
{{ key }}
{{ value }}
{% endfor %}
Click here for more nutrition information.
Enter quantity for food(g):
{% endfor %}
Nutrition Report