text:
# Modeling spatial point patterns with a marked log-Gaussian Cox process#

## Introduction#

The log-Gaussian Cox process (LGCP) is a probabilistic model of point patterns typically observed in space or time. It has two main components. First, an underlying intensity field $$\lambda(s)$$ of positive real values is modeled over the entire domain $$X$$ using an exponentially-transformed Gaussian process which constrains $$\lambda$$ to be positive. Then, this intensity field is used to parameterize a Poisson point process which represents a stochastic mechanism for placing points in space. Some phenomena amenable to this representation include the incidence of cancer cases across a county, or the spatiotemporal locations of crime events in a city. Both spatial and temporal dimensions can be handled equivalently within this framework, though this tutorial only addresses data in two spatial dimensions.

In more formal terms, if we have a space $$X$$ and $$A\subseteq X$$, the distribution over the number of points $$Y_A$$ occurring within subset $$A$$ is given by $$$Y_A \sim Poisson\left(\int_A \lambda(s) ds\right)$$$$and the intensity field is defined as$$$$\log \lambda(s) \sim GP(\mu(s), K(s,s'))$$$$where$$GP(\mu(s), K(s,s’))$$denotes a Gaussian process with mean function$$\mu(s)$$and covariance kernel$$K(s,s’)$$for a location$$s \in X$$. This is one of the simplest models of point patterns of$$n$$events recorded as locations$$s_1,…,s_n$ in an arbitrary metric space. In conjunction with a Bayesian analysis, this model can be used to answering questions of interest such as:

• Does an observed point pattern imply a statistically significant shift in spatial intensities?

• What would randomly sampled patterns with the same statistical properties look like?

• Is there a statistical correlation between the frequency and magnitude of point events?

In this notebook, we’ll use a grid-based approximation to the full LGCP with PyMC3 to fit a model and analyze its posterior summaries. We will also explore the usage of a marked Poisson process, an extension of this model to account for the distribution of marks associated with each data point.

## Data#

Our observational data concerns 231 sea anemones whose sizes and locations on the French coast were recorded. This data was taken from the spatstat spatial modeling package in R which is designed to address models like the LGCP and its subsequent refinements. The original source of this data is the textbook Spatial data analysis by example by Upton and Fingleton (1985) and a longer description of the data can be found there.

from itertools import product

import arviz as az
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pymc3 as pm

from numpy.random import default_rng

%config InlineBackend.figure_format = 'retina'
az.style.use("arviz-darkgrid")

data = pd.read_csv(pm.get_data("anemones.csv"))
n = data.shape[0]

This dataset has coordinates and discrete mark values for each anemone. While these marks are integers, for the sake of simplicity we will model these values as continuous in a later step.

data.head(3)

x y marks
0 27 7 6
1 197 5 4
2 74 15 4

Let’s take a look at this data in 2D space:

plt.scatter(data["x"], data["y"], c=data["marks"]),
plt.colorbar(label="Anemone size"), plt.axis("equal");

The ‘marks’ column indicates the size of each anemone. If we were to model both the marks and the spatial distribution of points, we would be modeling a marked Poisson point process. Extending the basic point pattern model to include this feature is the second portion of this notebook.

While there are multiple ways to conduct inference, perhaps the simplest way is to slice up our domain $$X$$ into many small pieces $$A_1, A_2,...,A_M$$ and fix the intensity field to be constant within each subset. Then, we will treat the number of points within each $$A_j$$ as a Poisson random variable such that $$Y_j \sim Poisson(\lambda_j)$$. and we also consider the $$\log{\lambda_1}...,\log{\lambda_M}$$ variables as a single draw from a Gaussian process.

The code below splits up the domain into grid cells, counts the number of points within each cell and also identifies its centroid.

xy = data[["x", "y"]].values

# Jitter the data slightly so that none of the points fall exactly
# on cell boundaries
eps = 1e-3
rng = default_rng()
xy = xy.astype("float") + rng.standard_normal(xy.shape) * eps

resolution = 20

# Rescaling the unit of area so that our parameter estimates
# are easier to read
area_per_cell = resolution**2 / 100

cells_x = int(280 / resolution)
cells_y = int(180 / resolution)

# Creating bin edges for a 2D histogram
quadrat_x = np.linspace(0, 280, cells_x + 1)
quadrat_y = np.linspace(0, 180, cells_y + 1)

# Identifying the midpoints of each grid cell
centroids = np.asarray(list(product(quadrat_x[:-1] + 10, quadrat_y[:-1] + 10)))

cell_counts, _, _ = np.histogram2d(xy[:, 0], xy[:, 1], [quadrat_x, quadrat_y])
cell_counts = cell_counts.ravel().astype(int)

With the points split into different cells and the cell centroids computed, we can plot our new gridded dataset as shown below.

line_kwargs = {"color": "k", "linewidth": 1, "alpha": 0.5}

plt.figure(figsize=(6, 4.5))
[plt.axhline(y, **line_kwargs) for y in quadrat_y]
[plt.axvline(x, **line_kwargs) for x in quadrat_x]
plt.scatter(data["x"], data["y"], c=data["marks"], s=6)

for i, row in enumerate(centroids):
shifted_row = row - 2
plt.annotate(cell_counts[i], shifted_row, alpha=0.75)

plt.title("Anemone counts per grid cell"), plt.colorbar(label="Anemone size");

We can see that all of the counts are fairly low and range from zero to five. With all of our data prepared, we can go ahead and start writing out our probabilistic model in PyMC3. We are going to treat each of the per-cell counts $$Y_1,...Y_M$$ above as a Poisson random variable.

# Inference#

Our first step is to place prior distributions over the high-level parameters for the Gaussian process. This includes the length scale $$\rho$$ for the covariance function and a constant mean $$\mu$$ for the GP.

with pm.Model() as lgcp_model:
mu = pm.Normal("mu", sigma=3)
rho = pm.Uniform("rho", lower=25, upper=300)
variance = pm.InverseGamma("variance", alpha=1, beta=1)
cov_func = variance * pm.gp.cov.Matern52(2, ls=rho)
mean_func = pm.gp.mean.Constant(mu)

Next, we transform the Gaussian process into a positive-valued process via pm.math.exp and use the area per cell to transform the intensity function $$\lambda(s)$$ into rates $$\lambda_i$$ parameterizing the Poisson likelihood for the counts within cell $$i$$.

with lgcp_model:
gp = pm.gp.Latent(mean_func=mean_func, cov_func=cov_func)

log_intensity = gp.prior("log_intensity", X=centroids)
intensity = pm.math.exp(log_intensity)

rates = intensity * area_per_cell
counts = pm.Poisson("counts", mu=rates, observed=cell_counts)

With the model fully specified, we can start sampling from the posterior using the default NUTS sampler. I’ll also tweak the target acceptance rate to reduce the number of divergences.

with lgcp_model:
trace = pm.sample(target_accept=0.95, chains=4, return_inferencedata=True)

Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (4 chains in 4 jobs)
NUTS: [log_intensity_rotated_, variance, rho, mu]

100.00% [8000/8000 04:48<00:00 Sampling 4 chains, 3 divergences]
Sampling 4 chains for 1_000 tune and 1_000 draw iterations (4_000 + 4_000 draws total) took 300 seconds.
There were 3 divergences after tuning. Increase target_accept or reparameterize.

# Interpreting the results#

Posterior inference on the length_scale parameter is useful for understanding whether or not there are long-range correlations in the data. We can also examine the mean of the log-intensity field, but since it is on the log scale it is hard to directly interpret.

az.summary(trace, var_names=["mu", "rho"])

mean sd hdi_3% hdi_97% mcse_mean mcse_sd ess_mean ess_sd ess_bulk ess_tail r_hat
mu -0.943 0.624 -2.131 0.232 0.012 0.009 2592.0 2590.0 2631.0 2527.0 1.0
rho 244.020 44.859 160.507 299.993 0.672 0.475 4462.0 4462.0 3945.0 2546.0 1.0

We are also interested in looking at the value of the intensity field at a large number of new points in space. We can accommodate this within our model by including a new random variable for the latent Gaussian process evaluated at a denser set of points. Using sample_posterior_predictive, we generate posterior predictions on new data points contained in the variable intensity_new.

x_new = np.linspace(5, 275, 20)
y_new = np.linspace(5, 175, 20)
xs, ys = np.asarray(np.meshgrid(x_new, y_new))
xy_new = np.asarray([xs.ravel(), ys.ravel()]).T

with lgcp_model:
intensity_new = gp.conditional("log_intensity_new", Xnew=xy_new)

spp_trace = pm.sample_posterior_predictive(
trace, var_names=["log_intensity_new"], keep_size=True
)
trace.extend(
az.from_dict(posterior_predictive=spp_trace, dims={"log_intensity_new": ["sample"]})
)
intensity_samples = np.exp(trace.posterior_predictive["log_intensity_new"])

100.00% [4000/4000 00:53<00:00]

Let’s take a look at a few realizations of $$\lambda(s)$$. Since the samples are on the log scale, we’ll need to exponentiate them to obtain the spatial intensity field of our 2D Poisson process. In the plot below, the observed point pattern is overlaid.

fig, axes = plt.subplots(2, 3, figsize=(8, 5), constrained_layout=True)
axes = axes.ravel()

field_kwargs = {"marker": "o", "edgecolor": "None", "alpha": 0.5, "s": 80}

for i in range(6):
field_handle = axes[i].scatter(
xy_new[:, 0], xy_new[:, 1], c=intensity_samples.sel(chain=0, draw=i), **field_kwargs
)

obs_handle = axes[i].scatter(data["x"], data["y"], s=10, color="k")
axes[i].axis("off")
axes[i].set_title(f"Sample {i}")

plt.figlegend(
(obs_handle, field_handle),
("Observed data", r"Posterior draws of $\lambda(s)$"),
ncol=2,
loc=(0.2, -0.01),
fontsize=14,
frameon=False,
);

While there is some heterogeneity in the patterns these surfaces show, we obtain a posterior mean surface with a very clearly defined spatial surface with higher intensity in the upper right and lower intensity in the lower left.

fig = plt.figure(figsize=(5, 4))

plt.scatter(
xy_new[:, 0],
xy_new[:, 1],
c=intensity_samples.mean(("chain", "draw")),
marker="o",
alpha=0.75,
s=100,
edgecolor=None,
)

plt.title("$E[\\lambda(s) \\vert Y]$")
plt.colorbar(label="Posterior mean");

The spatial variation in our estimates of the intensity field may not be very meaningful if there is a lot of uncertainty. We can make a similar plot of the posterior variance (or standard deviation) in this case:

fig = plt.figure(figsize=(5, 4))

plt.scatter(
xy_new[:, 0],
xy_new[:, 1],
c=intensity_samples.var(("chain", "draw")),
marker="o",
alpha=0.75,
s=100,
edgecolor=None,
)
plt.title("$Var[\\lambda(s) \\vert Y]$"), plt.colorbar();

The posterior variance is lowest in the middle of the domain and largest in the corners and edges. This makes sense - in locations where there is more data, we have more accurate estimates for what the values of the intensity field may be.

# Extending the model to include marks#

A shortcoming of the model from the previous section is that it is only modeling the number of points within a spatial domain and has no ability to represent the mark associated with each point. Here, the mark refers to the size of each anemone. We’ll augment the model from the previous section to see whether the intensity field $$\lambda(s)$$ also has an impact on the anemone size. To do this, we will model the mark size as a linear function of the intensity field with a normal likelihood. This is nearly identical to the model described in this paper by Ho and Stoyan (2008).

The first part of the extended model is exactly as before save for the fact that we must evaluate the GP at not just the centroids of the grid cells but also at the location of each anemone. augmented_coordinates includes both of these sets of points in a single array.

augmented_coordinates = np.vstack([centroids, data[["x", "y"]].values])

n_centroids = centroids.shape[0]

with pm.Model() as mark_model:
mu = pm.Normal("mu", sigma=3)
rho = pm.Uniform("rho", lower=25, upper=200)

cov_scale = pm.InverseGamma("scale", alpha=1, beta=1)

cov_func = cov_scale * pm.gp.cov.Matern52(2, ls=rho)
mean_func = pm.gp.mean.Constant(mu)
intensity_gp = pm.gp.Latent(mean_func=mean_func, cov_func=cov_func)

log_intensity = intensity_gp.prior("log_intensity", X=augmented_coordinates)
intensity = pm.math.exp(log_intensity)

rates = intensity[0:n_centroids] * area_per_cell
counts = pm.Poisson("counts", mu=rates, observed=cell_counts)

We can now add on an extension of the model for the marks. Letting the marks be denoted by $$z_i$$, we use the following formula to represent $$z_i$$:

$z_i = \alpha + \beta \lambda_i + \epsilon_i$

Equivalently, $$$z_i \sim N(\alpha + \beta \lambda_i, \sigma_\epsilon^2)$$$$where$$\sigma_\epsilon^2 = Var(\epsilon_i)$.

This equation states that the distribution of the marks is a linear function of the intensity field since we assume a normal likelihood for $$\epsilon$$. It’s essentially a simple linear regression of the marks on the intensity field; $$\alpha$$ is the intercept and $$\beta$$ is the slope. Then, standard priors are used for $$\epsilon, \alpha, \beta$$. The point of this model is to figure out whether or not the growth of the anemones is correlated with their occurrence. If we find that $$\beta$$ is negative, then that might hint that locations with more numerous anemones happen to also have smaller anemones and that competition for food may keep close neighbors small.

with mark_model:
alpha = pm.Normal("alpha", sigma=10.0)
beta = pm.Normal("beta", sigma=5)
eps_sd = pm.HalfCauchy("eps_sd", beta=1.0)

marks = pm.Normal(
"marks",
mu=alpha + beta * intensity[n_centroids::],
sigma=eps_sd,
shape=n,
observed=data["marks"].values,
)

It is important to note that this model takes much longer to run because using MCMC with Gaussian processes as implemented here requires a covariance matrix inversion with cubic time complexity in the number of spatial points. Since this GP is fit over 357 spatial points instead of ~120 points as in the previous model, it could take roughly $$3^3=27$$ times as long. Inference could be sped up dramatically using a sparse Gaussian process if faster sampling is required.

with mark_model:
trace = pm.sample(target_accept=0.95, return_inferencedata=True)

Auto-assigning NUTS sampler...
Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (4 chains in 4 jobs)
NUTS: [eps_sd, beta, alpha, log_intensity_rotated_, scale, rho, mu]

100.00% [8000/8000 58:36<00:00 Sampling 4 chains, 3 divergences]
Sampling 4 chains for 1_000 tune and 1_000 draw iterations (4_000 + 4_000 draws total) took 3528 seconds.
There were 2 divergences after tuning. Increase target_accept or reparameterize.
There was 1 divergence after tuning. Increase target_accept or reparameterize.

The posterior summaries indicate that most of the probability mass for $$\beta$$ is on negative values. This gives us a high posterior probability that the intensity field (i.e. the number of anemones) is anti-correlated with the size of each anemone!

az.summary(trace, var_names=["alpha", "beta"])

mean sd hdi_3% hdi_97% mcse_mean mcse_sd ess_mean ess_sd ess_bulk ess_tail r_hat
alpha 5.642 0.682 4.588 6.928 0.026 0.018 698.0 698.0 1425.0 1018.0 1.0
beta -2.888 1.477 -5.736 -0.646 0.056 0.040 691.0 691.0 1438.0 1001.0 1.0
• This notebook was written by Christopher Krapu on September 6, 2020 and updated on April 1, 2021.

%load_ext watermark
%watermark -n -u -v -iv -w

Last updated: Fri Apr 02 2021

Python implementation: CPython
Python version       : 3.8.8
IPython version      : 7.20.0

numpy     : 1.19.2
matplotlib: 3.3.4
pymc3     : 3.11.0
pandas    : 1.2.2
arviz     : 0.11.0

Watermark: 2.2.0


text:
# Geometry Help Needed

I'm really bad in Geometry. Can anyone recommend good books about geometry? Or any tips to be good in it?

Note by Daniel Lim
6 years, 8 months ago

This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.

When posting on Brilliant:

• Use the emojis to react to an explanation, whether you're congratulating a job well done , or just really confused .
• Ask specific questions about the challenge or the steps in somebody's explanation. Well-posed questions can add a lot to the discussion, but posting "I don't understand!" doesn't help anyone.
• Try to contribute something new to the discussion, whether it is an extension, generalization or other idea related to the challenge.

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in $$ ... $$ or $ ... $ to ensure proper formatting.
2 \times 3 $2 \times 3$
2^{34} $2^{34}$
a_{i-1} $a_{i-1}$
\frac{2}{3} $\frac{2}{3}$
\sqrt{2} $\sqrt{2}$
\sum_{i=1}^3 $\sum_{i=1}^3$
\sin \theta $\sin \theta$
\boxed{123} $\boxed{123}$

Sort by:

'Geometry Revisited' is one of the best books on geometry.

- 6 years, 8 months ago

Thanks

- 6 years, 8 months ago

u should consider this book: challenging problems in geometry...(ask your friend to photostat)

- 6 years, 8 months ago

Ok, thanks

- 6 years, 8 months ago

- 6 years, 8 months ago

May i know how to get the book? Is it sold in bookshops or...? Thanks

- 6 years, 8 months ago

I got it when i made it to the maths olympiad top 60 training camp (so shameful to said it lol)

- 6 years, 8 months ago

Ok thanks...so cool you can get into Malaysia's top 60. Is the training camp students selected from omk or another selection test? For me, omk is not easy...hard! :'( Here, can i ask an omk question (2011)?Question: Prove that any triangle can be cut into six similar triangles.(Your proof must be valid for all types of triangle but not a specific type only.) Thanks:-)

- 6 years, 8 months ago

omk is on this saturday

- 6 years, 8 months ago

Yes...

- 6 years, 8 months ago

Draw all three medians from each vertex to the opposite side. This is because if the triangle split by medians then the two parts will have the same area since their base length and height is the same. (Maybe more things are needed to add in....actually I was stumped when i was in form 1...)

- 6 years, 8 months ago

How do we know that the corresponding angles of triangles after being cut by median is the same? Because they ought to be similar...

What do you mean by"More things" need to add in? I'm curious. ..

I'm in form 1...stumped too...:-P juz kidding...Btw, thanks.

- 6 years, 8 months ago

To learn all the basics of geometry, you should read Euclid's Elements. It is quite insightful.

- 6 years, 8 months ago

Ok, thanks

- 6 years, 8 months ago

format: plain


text:
# American Institute of Mathematical Sciences

March  2013, 18(2): 483-493. doi: 10.3934/dcdsb.2013.18.483

## Periodic solutions of isotone hybrid systems

 1 Department of Mathematics and Statistics, University of Maryland Baltimore County (UMBC), Baltimore, MD 21250, United States 2 Weierstrass Institute for Applied Analysis and Stochastics (WIAS), Mohrenstr. 39, 10117 Berlin, Germany

Received  December 2011 Revised  August 2012 Published  November 2012

Suggested by conversations in 1991 (Mark Krasnosel'skiĭ and Aleksei Pokrovskiĭ with TIS), this paper generalizes earlier work [7] of theirs by defining a setting of hybrid systems with isotone switching rules for a partially ordered set of modes and then obtaining a periodicity result in that context. An application is given to a partial differential equation modeling calcium release and diffusion in cardiac cells.
Citation: Thomas I. Seidman, Olaf Klein. Periodic solutions of isotone hybrid systems. Discrete & Continuous Dynamical Systems - B, 2013, 18 (2) : 483-493. doi: 10.3934/dcdsb.2013.18.483
##### References:
 [1] G. Birkhoff, "Lattice Theory,", $2^{nd}$ rev. ed., 25 (1948). Google Scholar [2] A. Friedman and L.-S. Jiang, Periodic solutions for a thermostat control problem,, Comm. PDE, 13 (1988), 515. Google Scholar [3] K. Glashoff and J. Sprekels, The regulation of temperature by thermostats and set-valued integral equations,, J. Int. Eqns., 4 (1982), 95. Google Scholar [4] G. Gripenberg, On periodic solutions of a thermostat equation,, SIAM J. Math. Anal., 18 (1987), 694. Google Scholar [5] F. Hante, G. Leugering and T. I. Seidman, An augmented BV setting for feedback switching control,, J. Systems Sci. & Comp., 23 (2010), 456. doi: 10.1007/s11424-010-0140-0. Google Scholar [6] L. T. Izu, W. G. Wier, and C. W. Balke, Evolution of cardiac calcium waves from stochastic calcium sparks,, Biophysical Journal, 80 (2001), 103. doi: 10.1016/S0006-3495(01)75998-X. Google Scholar [7] M. A. Krasnosel'skiĭ and A. V. Pokrovskiĭ, Periodic oscillations in systems with relay nonlinearities,, (transl. from (MR0355210), 216 (1974), 733. Google Scholar [8] M. A. Krasnosel'skiĭ and A .V. Pokrovskiĭ, "Systems with Hysteresis,", (transl. of, (1983). Google Scholar [9] O. A. Ladyženskaja, V. A. Solonnikov and N. N. Ural'ceva, "Linear and Quasilinear Equations of Parabolic Type,", Translations of Math. Monographs, (1968). Google Scholar [10] T. I. Seidman, Switching systems: thermostats and periodicity,, Report MRR-83-07, MRR-83-07 (1983), 83. Google Scholar [11] T. I. Seidman, Switching systems I,, Control and Cybernetics, 19 (1990), 63. Google Scholar [12] T. I. Seidman, Switching systems and periodicity,, in, (1989), 199. Google Scholar [13] B. Stoth, "Periodische Lösungen Von Linearen Thermostat Problemen,", Diplomthesis: (Report SFB 256), SFB 256 (1987). Google Scholar [14] W. Szczechla, "Periodicity for Certain Switching Systems,", Ph.D thesis, (1993). Google Scholar

show all references

##### References:
 [1] G. Birkhoff, "Lattice Theory,", $2^{nd}$ rev. ed., 25 (1948). Google Scholar [2] A. Friedman and L.-S. Jiang, Periodic solutions for a thermostat control problem,, Comm. PDE, 13 (1988), 515. Google Scholar [3] K. Glashoff and J. Sprekels, The regulation of temperature by thermostats and set-valued integral equations,, J. Int. Eqns., 4 (1982), 95. Google Scholar [4] G. Gripenberg, On periodic solutions of a thermostat equation,, SIAM J. Math. Anal., 18 (1987), 694. Google Scholar [5] F. Hante, G. Leugering and T. I. Seidman, An augmented BV setting for feedback switching control,, J. Systems Sci. & Comp., 23 (2010), 456. doi: 10.1007/s11424-010-0140-0. Google Scholar [6] L. T. Izu, W. G. Wier, and C. W. Balke, Evolution of cardiac calcium waves from stochastic calcium sparks,, Biophysical Journal, 80 (2001), 103. doi: 10.1016/S0006-3495(01)75998-X. Google Scholar [7] M. A. Krasnosel'skiĭ and A. V. Pokrovskiĭ, Periodic oscillations in systems with relay nonlinearities,, (transl. from (MR0355210), 216 (1974), 733. Google Scholar [8] M. A. Krasnosel'skiĭ and A .V. Pokrovskiĭ, "Systems with Hysteresis,", (transl. of, (1983). Google Scholar [9] O. A. Ladyženskaja, V. A. Solonnikov and N. N. Ural'ceva, "Linear and Quasilinear Equations of Parabolic Type,", Translations of Math. Monographs, (1968). Google Scholar [10] T. I. Seidman, Switching systems: thermostats and periodicity,, Report MRR-83-07, MRR-83-07 (1983), 83. Google Scholar [11] T. I. Seidman, Switching systems I,, Control and Cybernetics, 19 (1990), 63. Google Scholar [12] T. I. Seidman, Switching systems and periodicity,, in, (1989), 199. Google Scholar [13] B. Stoth, "Periodische Lösungen Von Linearen Thermostat Problemen,", Diplomthesis: (Report SFB 256), SFB 256 (1987). Google Scholar [14] W. Szczechla, "Periodicity for Certain Switching Systems,", Ph.D thesis, (1993). Google Scholar
 [1] Teck-Cheong Lim. On the largest common fixed point of a commuting family of isotone maps. Conference Publications, 2005, 2005 (Special) : 621-623. doi: 10.3934/proc.2005.2005.621 [2] Silvia Sastre-Gomez. Equivalent formulations for steady periodic water waves of fixed mean-depth with discontinuous vorticity. Discrete & Continuous Dynamical Systems - A, 2017, 37 (5) : 2669-2680. doi: 10.3934/dcds.2017114 [3] Sorin Micu, Ademir F. Pazoto. Almost periodic solutions for a weakly dissipated hybrid system. Mathematical Control & Related Fields, 2014, 4 (1) : 101-113. doi: 10.3934/mcrf.2014.4.101 [4] Luca Dieci, Timo Eirola, Cinzia Elia. Periodic orbits of planar discontinuous system under discretization. Discrete & Continuous Dynamical Systems - B, 2018, 23 (7) : 2743-2762. doi: 10.3934/dcdsb.2018103 [5] Jerry L. Bona, Thierry Colin, Colette Guillopé. Propagation of long-crested water waves. Ⅱ. Bore propagation. Discrete & Continuous Dynamical Systems - A, 2019, 39 (10) : 5543-5569. doi: 10.3934/dcds.2019244 [6] Adrian Constantin. Dispersion relations for periodic traveling water waves in flows with discontinuous vorticity. Communications on Pure & Applied Analysis, 2012, 11 (4) : 1397-1406. doi: 10.3934/cpaa.2012.11.1397 [7] Calin Iulian Martin. Dispersion relations for periodic water waves with surface tension and discontinuous vorticity. Discrete & Continuous Dynamical Systems - A, 2014, 34 (8) : 3109-3123. doi: 10.3934/dcds.2014.34.3109 [8] Bogdan Kazmierczak, Zbigniew Peradzynski. Calcium waves with mechano-chemical couplings. Mathematical Biosciences & Engineering, 2013, 10 (3) : 743-759. doi: 10.3934/mbe.2013.10.743 [9] Nicholas Long. Fixed point shifts of inert involutions. Discrete & Continuous Dynamical Systems - A, 2009, 25 (4) : 1297-1317. doi: 10.3934/dcds.2009.25.1297 [10] Calin Iulian Martin, Adrián Rodríguez-Sanjurjo. Dispersion relations for steady periodic water waves of fixed mean-depth with two rotational layers. Discrete & Continuous Dynamical Systems - A, 2019, 39 (9) : 5149-5169. doi: 10.3934/dcds.2019209 [11] Yakov Krasnov, Alexander Kononovich, Grigory Osharovich. On a structure of the fixed point set of homogeneous maps. Discrete & Continuous Dynamical Systems - S, 2013, 6 (4) : 1017-1027. doi: 10.3934/dcdss.2013.6.1017 [12] Jorge Groisman. Expansive and fixed point free homeomorphisms of the plane. Discrete & Continuous Dynamical Systems - A, 2012, 32 (5) : 1709-1721. doi: 10.3934/dcds.2012.32.1709 [13] Shui-Hung Hou. On an application of fixed point theorem to nonlinear inclusions. Conference Publications, 2011, 2011 (Special) : 692-697. doi: 10.3934/proc.2011.2011.692 [14] Luis Hernández-Corbato, Francisco R. Ruiz del Portal. Fixed point indices of planar continuous maps. Discrete & Continuous Dynamical Systems - A, 2015, 35 (7) : 2979-2995. doi: 10.3934/dcds.2015.35.2979 [15] Antonio Garcia. Transition tori near an elliptic-fixed point. Discrete & Continuous Dynamical Systems - A, 2000, 6 (2) : 381-392. doi: 10.3934/dcds.2000.6.381 [16] Pavel Gurevich. Periodic solutions of parabolic problems with hysteresis on the boundary. Discrete & Continuous Dynamical Systems - A, 2011, 29 (3) : 1041-1083. doi: 10.3934/dcds.2011.29.1041 [17] Fábio Natali, Ademir Pastor. Orbital stability of periodic waves for the Klein-Gordon-Schrödinger system. Discrete & Continuous Dynamical Systems - A, 2011, 31 (1) : 221-238. doi: 10.3934/dcds.2011.31.221 [18] Hany A. Hosham, Eman D Abou Elela. Discontinuous phenomena in bioreactor system. Discrete & Continuous Dynamical Systems - B, 2019, 24 (6) : 2955-2969. doi: 10.3934/dcdsb.2018294 [19] Shin-Ichiro Ei, Kei Nishi, Yasumasa Nishiura, Takashi Teramoto. Annihilation of two interfaces in a hybrid system. Discrete & Continuous Dynamical Systems - S, 2015, 8 (5) : 857-869. doi: 10.3934/dcdss.2015.8.857 [20] Wenhua Qiu, Jianguo Si. On small perturbation of four-dimensional quasi-periodic system with degenerate equilibrium point. Communications on Pure & Applied Analysis, 2015, 14 (2) : 421-437. doi: 10.3934/cpaa.2015.14.421

2018 Impact Factor: 1.008


text:
# Headerlets and You: Astrometry in Drizzle Products¶

The astrometry for any given observation relies upon accurate pointing information from the telescope. However, HST has evolved over time since it was put into orbit, with the focus changing over time as the telescope desorbs. The instruments have also changed positions over time relative to the FGS guides, and the coordinates for the guide stars were orginally determined using ground-based information. All this has limited the calculation of the pointing of any given observation on the sky (absolute astrometry) to no better than 1-2 arc-seconds.

Calibration of the distortion model for each instrument has been done well enough to allow observations to be combined (relative astrometry) with an accuracy of better than 5 milli-arcseconds. This has made the absolute astrometry inaccuracy stand out even more, making it more difficult to compare observations taken at different times or to compare HST data with observations from other telescopes (like Chandra).

Therefore, multiple efforts have been undertaken to improve the absolute astrometry to match the accuracy of the relative astrometry. These efforts have resulted in multiple new world coordinate systems (WCS) solutions to be developed for HST observations, starting with ACS, WFC3, and WFPC2. Complete details of the results of calibrating the distortion models and astrometry for each instrument can be found in each of the instruments web pages; namely,

Each solution has its own advantages and errors, making some good for one use but inadequate for others. As a result, all new WCS solutions which are approved by STScI are being offered with HST data provided by MAST with headerlets serving as the mechanism for providing and applying all WCS solutions.

## Where are all the WCS solutions?¶

All calibrated HST products delivered by the Barbara A. Mikulski Archive for Space Telescopes (MAST) contain the best available WCS solutions available at the time the data was last processed. Unfortunately, only 1 WCS can be used at a time to transform the position in the image to an undistorted position on the sky. The FITS Standard, however, describes how multiple WCS solutions can be defined for an image in FITS Paper I (Greisen, E. W., and Calabretta, M. R., Astronomy & Astrophysics, 395, 1061-1075, 2002).

This standard defines a keyword, WCSNAME, which serves as the label for the WCS specified in the header of the observation. It also defines additional keywords, WCSNAME[A-Z], that represent additional WCS solutions which are specified as alternate WCS solutions in the same header as the active WCS associated with WCSNAME. Headerlets rely on the use of the WCSNAME keyword to manage the multiple solutions that may be defined for a given observation, with each WCS having it’s own unique WCSNAME value. Headerlets also build the HDRNAME keyword which specifies the exposure name as well WCS to insure that this WCS will only ever be applied to this exposure and no other.

The use of headerlets extends this standard by allowing each new WCS, specified using the FITS Paper I standards along with the SIP convention, to be stored separately as a new extension at the end of the image’s FITS file. This can be seen in the extensions listed by astropy.fits for a sample ACS/WFC image which includes 6 additional WCS solutions from the astrometry database.:

No.    Name      Ver    Type      Cards   Dimensions   Format
0  PRIMARY       1 PrimaryHDU     279   ()
1  SCI           1 ImageHDU       201   (4096, 2048)   float32
2  ERR           1 ImageHDU        57   (4096, 2048)   float32
3  DQ            1 ImageHDU        49   (4096, 2048)   int16
4  SCI           2 ImageHDU       199   (4096, 2048)   float32
5  ERR           2 ImageHDU        57   (4096, 2048)   float32
6  DQ            2 ImageHDU        49   (4096, 2048)   int16
7  D2IMARR       1 ImageHDU        15   (64, 32)   float32
8  D2IMARR       2 ImageHDU        15   (64, 32)   float32
9  D2IMARR       3 ImageHDU        15   (64, 32)   float32
10  D2IMARR       4 ImageHDU        15   (64, 32)   float32
11  WCSDVARR      1 ImageHDU        15   (64, 32)   float32
12  WCSDVARR      2 ImageHDU        15   (64, 32)   float32
13  WCSDVARR      3 ImageHDU        15   (64, 32)   float32
14  WCSDVARR      4 ImageHDU        15   (64, 32)   float32
15  WCSCORR       1 BinTableHDU     59   14R x 24C   [40A, I, A, 24A, 24A, 24A, 24A, D, D, D, D, D, D, D, D, 24A, 24A, D, D, D, D, J, 40A, 128A]
16  HDRLET        1 HeaderletHDU     22   ()
17  HDRLET        2 HeaderletHDU     22   ()
18  HDRLET        3 HeaderletHDU     26   ()
19  HDRLET        4 HeaderletHDU     26   ()
20  HDRLET        5 HeaderletHDU     26   ()
21  HDRLET        6 HeaderletHDU     26   ()

In this example, extensions 16 through 21 contain headerlets each of which specifies different astrometric alignment (each may potentially be based on a different distortion model) and each has been assigned a unique name given by the WCSNAME keyword. A quick listing of the names of all these WCSs can be obtained using the Python library STWCS:

['OPUS',
'IDC_0461802ej',
'OPUS-GSC240',
'IDC_0461802ej-GSC240',
'OPUS-HSC30',
'IDC_0461802ej-HSC30']

### Interpreting WCS names¶

The first WCS solution listed, OPUS, corresponds to the default WCS defined by the HST calibration pipeline based on original telemetry and only a first-order distortion model. Solutions which contain IDC_ are based on the distortion model based on the reference data associated with the IDCTAB reference file whose rootname is specified in the WCSNAME. For example, IDC_0461802ej refers to a WCS solution based on the IDCTAB reference file 0461802ej_idc.fits along with all the associated secondary distortion reference files given by DGEOFILE, NPOLFILE and, for WFPC2, OFFTAB and DXYFILE.

Additional WCS solutions will then be based on either the original OPUS WCS or the distortion-corrected IDC_ WCS solutions. Two types of solutions can be defined for images; namely, a priori and a posteriori solutions.

#### a priori solutions¶

The a priori solutions have been determined for ALL HST data by correcting the coordinates of the guide stars that were used from the originally specified coordinates to the coordinates of those guide stars as determined by GAIA. The naming convention for these a priori solutions are:

<Starting WCS>-<Astrometric Catalog>

For example,
'IDC_0461802ej-GSC240'

where the Astrometric Catalog refers the exact astrometric catalog used to correct the guide star positions. A number of Astrometric Catalogs are available through MAST for aligning images. Solutions generated for the database were initially based on catalogs which were based on the GAIA catalog. These GAIA-based catalogs include:

• GSC240
• This catalog contains version 2.4.0 of the Guide Star Coordinates (GSC) catalog,
• All guide stars in the catalog were cross-matched with the GAIA DR1 catalog and corrected to the coordinates reported in GAIA DR1.
• APPLIES TO: All HST datasets which had a successful guide star acquisition, which is nearly all data in the archive.
• NOTE: HST Observations taken after September 2017.
• HSC30
• This catalog contains version 3.0 of the Hubble Source Catalog (HSC)
• Technically, this is an a posteriori solution, but it is applied blindly without further verification that the correction fully aligns the image to GAIA;hence, it is included as an a priori solution.
• Sources in the HSC were cross-matched with the GAIA DR1 catalog.
• Those cross-matched sources were then used to determine a fit to the GAIA catalog.
• The fit to GAIA was then applied to all remaining sources in the catalog.
• APPLIES TO: Only datasets which had a sufficient number of sources in the exposure to be aligned to GAIA by the Hubble Legacy Archive(HLA) project.
• A MAST-provided version of the first data release (DR1) version of the official GAIA astrometric catalog.
• This version does not have proper motions for a majority of the sources in the catalog.
• A MAST-provided version of the second data release version of the official GAIA astrometric catalog.
• This catalog contains initial proper motion measurements (and errors) for most sources in the catalog.

Although all solutions are appended to each FITS file, only 1 WCS (referred to as the ‘active’ WCS) can be used at a time to represent the transformation from pixel coordinates to world coordinates. The active WCS is defined by the standard WCS keywords found in the header of the science extension for each chip in the exposure; e.g., CRVAL1, CRVAL2, CRPIX1, CRPIX2, and so on.

The a priori solution which gets selected to replace the active WCS solution represents the most accurate solution available in the astrometry database at the time, and will be chosen based on the following hierarchy (as of Summer 2019):

1. HSC30
2. GSC240
3. IDC_<rootname> (distortion-corrected pipeline default WCS)

If the first type of solution is not available, the next solution in the list is selected. As new solutions are added to the astrometry database, these rules will be modified to always try to return the WCS correction which best aligns the data to the GAIA catalog.

#### a posteriori solutions¶

The a posteriori solutions, on the other hand, get determined from measuring sources in each image, finding overlapping sources from an astrometric catalog, identifying and cross-matching image sources with sources from the astrometric catalog and performing a fit to correct the WCS. These type of solutions can not be determined for all datasets due to a number of reasons, such as lack of sources in the image and/or lack of overlapping sources from an astrometric catalog. When these solutions can be determined for an observation, they are given a value for the WCSNAME keyword which follows the convention:

<Starting WCS>-FIT_<REL|IMG|EVM|SVM>_<Astrometric Catalog>

For example,

The terms are defined as:

• <Starting WCS>
• Value of WCSNAME for the exposure prior to applying any astrometric Solutions
• IDC_<rootname> (like IDC_041802ej) refers to a distortion-corrected model based on the IDCTAB reference file 0461802ej_idc.fits.
• FIT
• This term refers to the fact that sources from the image were identified, cross-matched and fit to sources from an astrometric catalog to create an a posteriori WCS solution.
• <REL|IMG|EVM|SVM>
• REL : This term denotes the fact that all images were aligned relative (REL) to each other and then aligned to an astrometric catalog. This attempts to maintain the original relative alignment between the images in a given visit.
• IMG : This term denotes the fact the the images were fit individually to the astrometric catalog. These solutions are applied only when relative alignment does not yield a viable fit to the astrometric catalog.
• EVM : The cross-match and fit to an astrometric catalog was performed on a single exposure by itself as part of processing the exposures of an entire visit. This will typically only apply to those rare visits which do not have enough valid exposures in the visit for alignment.
• SVM : This term refers to alignment of all the exposures in a single-visit to an astrometric catalog. The exposures of a visit are aligned to each other (relative alignment), then, as a group, all the exposures are cross-matched and fit to the astrometric catalog specified in the next term in the WCSNAME.
• <Astrometric Catalog>
• This term describes the astrometric catalog, as listed for use with the a priori solutions, which was used for the cross-matching and fitting sources identified in the image(s). If a value of NONE is specified here, it indicates that although the image appears (according to the code) to have been successfully relatively aligned one exposure to another, there were indications that the alignment to an astrometric catalog like GAIADR2 failed. The user will need to carefully review the state of alignment of this data when NONE is listed in the output WCS.

These separate terms provide as succinct a description of the solution determined for and applied to the exposure as possible. Additional keywords have been written out to the headerlet extension for the a posteriori fit which further describe the solution, including:

• number of sources used in the fit
• RMS in RA and Dec of the fit
• parameters determined for the fit
• and more…

Note

A successfully determined a posteriori solution will always be used to replace the active WCS (after insuring the previous WCS has been saved as a headerlet extension already) regardless of the original solution.

### Pipeline Processing¶

All HST observations get processed in an automated environment using standard parameters for the calibration code, including the alignment and combination of individual exposures into undistorted products. The standard pipeline processing to create the undistorted drizzled images (drc.fits or drz.fits) gets performed using the ‘runastrodriz’ task in this package. This same processing can be run at any time using:

runastrodriz j8cw03010_asn.fits

runastrodriz j8cw03f6q_raw.fits

The files which need to be present are:

• RAW files (*raw.fits)
• FLT files (*flt.fits)
• FLC files (*flc.fits, if any were created by the pipeline)
• ASN file (*asn.fits, if applicable)

This processing includes a lot of logic intended to not only apply pre-defined (apriori) WCS solutions, but also to try and determine a new aposteriori solution then verify which solution (default pipeline, apriori or aposteriori) actually provides the WCS which comes closest to the GAIA astrometric frame. The Pipeline Astrometric Calibration Description of the runastrodriz task provides the full discussion of the logic used to define the defined ‘active’ WCS that gets used to create the products which get archived.

### Choosing a WCS¶

The only WCS solution that gets used to perform coordinate transformations on the pixel values will be the ‘active’ or ‘primary’ WCS associated with the WCSNAME keyword. The pipeline generated products will include an active WCS which the pipeline specifies as the best available WCS given the information used at the time of processing. However, this default ‘active’ WCS may not be appropriate for all science, so this WCS may need to be replaced by one of the other WCSs instead to best support the analysis necessary for the research.

#### Dependent Packages¶

Working with the WCS solutions and headerlets gets performed using STWCS package. Examples of how to work with this package will assume that the user has already installed this package into their working Python environment and has started a python shell. In addition, the following example relies on the Astropy IO package to work with the FITS headers and extensions.

Finally, the example described here will rely on additional functionality included in the V3.2.0 or later of the Drizzlepac package. These new functions support the generation of drizzle combined products which have been aligned to an astrometric standard catalog such as GAIA DR2.

#### Sample Session¶

This example will work with 4 exposures taken using ACS/WFC as the association j95y04010, with most of the example being performed on the single exposure j95y04hpq_flc.fits.

All the necessary libraries for working on this example can be imported using:

from drizzlepac.haputils import astroquery_utils as aqutils
from drizzlepac.haputils import astrometric_utils as amutils
from astropy.io import fits

The data can be obtained from MAST with astroquery using a simplified interface developed in drizzlepac using the commands:

filenames = aqutils.retrieve_observation('j95y04010')
# filenames = ['j95y04hpq_flc.fits', 'j95y04hqq_flc.fits',
#              'j95y04hsq_flc.fits', 'j95y04huq_flc.fits']

The default ‘active’ WCS can be determined using:

default_wcsname = fits.getval(filenames[0], 'wcsname', ext=1)

For this example, we find that default_wcsname=’IDC_0461802ej’, or as noted earlier, the default distortion correction based WCS provided by the pipeline with no correction for any astrometric catalogs, has been designated by the pipeline as the ‘active’ WCS.

All available WCSs provided by the astrometry database and attached as headerlet extensions can be queried to find the WCSNAMEs for all the new WCSs using:

These will be the same ones listed earlier. For this example, we decide we would like to have this observation aligned using the guide stars corrected to GAIA DR1 through the use of the GSC240-based WCS; specifically, IDC_0461802ej-GSC240. We can replace the ‘active’ WCS with this new one using:

# identify hdrname that corresponds with desired WCS with name of IDC_041802ej-GSC240
new_wcs = new_hdrnames[new_wcsnames.index('IDC_0416802ej-GSC240')]
# confirm new WCS is now 'active'
fits.getval(filenames[0], 'wcsname', ext=1)

At this point, the exposure has been updated to perform all coordinate transformations with the new GAIA DR1-based WCS as if the guide stars used for taking the observation has GAIA DR1 coordinates in the first place. This will not mean it will align perfectly with GAIA, but should be within 0.5 arcseconds due to drift in the telescope field-of-view for each of the instruments relative to the FGSs.

The headerlet file itself conforms to FITS standards with the PRIMARY header containing global information about the WCS solution and how it was determined. Separate extensions in the headerlet then contain the header keywords for specifying the WCS for each chip in the exposure or for the distortion information necessary to correct the pixel positions from the image to the un-distorted position on the sky. These solutions rely on calibration reference data that describe the distortion observed in each instrument to better than 0.1 pixels in each detector. Instead of having to retrieve separate files with this distortion information, that distortion information has been folded into the header of each WFC3, ACS and WFPC2 dataset.

This new object complete with the NPOLFILE and the D2IMFILE extensions derived from the full FITS file fully describes the WCS of each chip and serves without further modification as the definition of the headerlet. The listing of the FITS extensions for a headerlet for the sample ACS/WFC exposure after writing it out to a file would then be:

EXT#  FITSNAME      FILENAME              EXTVE DIMENS       BITPI OBJECT

0     j8hw27c4q     j8hw27c4q_hdr.fits                       16
1       IMAGE       D2IMARR               1     4096         -32
2       IMAGE       WCSDVARR              1     64x32        -32
3       IMAGE       WCSDVARR              2     64x32        -32
4       IMAGE       WCSDVARR              3     64x32        -32
5       IMAGE       WCSDVARR              4     64x32        -32
6       IMAGE       SIPWCS                1                  8
7       IMAGE       SIPWCS                2                  8


text:
# Find the area of the smaller region bounded by the ellipse $$\frac{\large x^2}{\large 9} + \frac{\large y^2}{\large 4} =1$$ and the line $$\frac{\large x}{\large 3}+ \frac{\large y}{\large 2}= 1$$

Hence the required area is the area enclosed between the straight line and the ellipse.
To find the limits,the semi major axis extends from 0 to 3 and the x intercept of the straight line is also 3.so the limits are from 0 to 3
The required area is $A=\int_a^b[f(x)-g(x)]dx$
Here a=0,b=3,$f(x)=\frac{x^2}{9}+{y^2}{4}=1$
$\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;=\frac{2}{3}[\sqrt{9-x^2}]$
$g(x)=\frac{x}{3}+\frac{y}{2}=1=\frac{2}{3}(3-x).$
$A=\frac{2}{3}\int_0^3\sqrt {9-x^2}dx-\frac{2}{3}\int_0^3(3-x)dx$
On integrating we get,
$A=\frac{2}{3}\begin{bmatrix}\frac{x}{2}\sqrt {9-x^2}+\frac{9}{2}\sin^{-1}(\frac{x}{3})\end{bmatrix}_0^3$
$\;=\frac{2}{3}\begin{bmatrix}3x-\frac{x^2}{2}\end{bmatrix}_0^3$
On applying the limits we get,
$A=\frac{2}{3}\begin{bmatrix}\frac{9}{2}(\frac{\pi}{2})\end{bmatrix}-\frac{2}{3}\begin{bmatrix}9-\frac{9}{2}\end{bmatrix}$
$\;\;\;=\frac{2}{3}\begin{bmatrix}\frac{9\pi}{4}-\frac{9}{2}\end{bmatrix}=\frac{2}{3}\times \frac{9}{4}(\pi-2)$
Hence the required area is $\frac{3}{2}(\pi-2)sq.units$


text:
#### Archived

This topic is now archived and is closed to further replies.

# Viewport, Ortho result is twice desired size

This topic is 5156 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Dear all, I am a little puzzled by viewports and the Ortho projection matrix at the moment. Using the following code, I am defining viewport that is the top right quater of a window, and as an experiment defining the viewport to have 2 units for X & Y What puzzles me is that when I draw the square (in the code) it is the entire viewport size, not 1 quater of the viewport size!! Have I missed something here??? Thanks guys Paul.
glViewport(m_uWidth / 2, m_uHeight / 2, m_uWidth, m_uHeight);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0, 2, 0, 2);
glMatrixMode(GL_MODELVIEW);
glColor3f(1.0f, 1.0f, 1.0f);
glVertex2i(0, 0);
glVertex2i(0, 1);
glVertex2i(1, 1);
glVertex2i(1, 0);
glVertex2i(0, 0);
glEnd();

##### Share on other sites
quote:
Original post by pprice001
... I am defining viewport that is the top right quater of a window...

Hint: Check some documentation on what the two last parameters of glViewport means.

##### Share on other sites
What a minute, I think I might have another stupid question!!

Thanks, I obviously suffer from some kind of lazy reading problem, first word and last word of every sentence or something!

But now I understand, appreciated!

Paul.


text:
# Classical Action for Harmonic Oscillator

by DeclanTKatt
Tags: action, classical, harmonic, oscillator
 P: 3 1. The problem statement, all variables and given/known data Hello. I am attempting to evaluate the classical action of a harmonic oscillator by using the Euler-Lagrange equations. 2. Relevant equations The Lagrangian for such an oscillator is L=(1/2)m($$\dot{x}$$2-$$\omega$$2x2) This is easy enough to solve for. The classical action is defined by Scl=$$\int$$L dt 3. The attempt at a solution I know what the answer is, but I am having difficulty achieving it. So far I have used: x=sin($$\omega$$t) $$\dot{x}$$=$$\omega$$cos($$\omega$$t) Substituted these into the Lagrangian and then integrated, with respect to t, for the classical action. This did not provide the proper results. Any suggestions would be greatly appreciated. Thanks

 Related Discussions Advanced Physics Homework 3 Introductory Physics Homework 1 Advanced Physics Homework 2 Introductory Physics Homework 1


text:
NCERT Solutions For Class 9 Math | Exercise 2.1

Chapter 2 | Polynomials | 5 Questions

Detailed solution to all exercise questions of NCERT book for CBSE Class 9 Math in Chapter 2 - Polynomials - Exercise 2.1. The exercise comprises 5 questions.

Key concepts covered in this exercise include polynomials in one variable, coefficients of terms in a polynomial, classification of polynomials as monomial, binomial, and classification of polynomials as linear, quadratic, and cubic polynomials.

1. Question 1

Which of the following expressions are polynomials in one variable and which are not? State reasons for your answer.
(i) 4x2 - 3x + 1
(ii) y2 + √2
(iii) 3√t + t√2
(iv) y + $$frac{2}{y}$$v) x10 + y3 + t50

Solution

(i) 4x2 - 3x + 1
It is a polynomial in one variable.
There is only one variable x and all the exponents are whole numbers.

(ii) y2 + √2
It is a polynomial in one variable.
There is only one variable y and its power is a whole number.

(iii) 3√t + t√2
It is NOT a polynomial in one variable.
The exponent of ‘t’ in √t is $$frac{1}{2}$ which is not a whole number.$iv) y + $$frac{2}{y}$ It is NOT a polynomial in one variable. The exponent of y in $\frac{2}{y}$ is -1, which is not a whole number.$v) x10 + y3 + t50
It is NOT a polynomial in one variable.
There are multiple variables involved i.e., x, y, and t

2. Question 2

Write the coefficients of x2 in each of the following :
(i) 2 + x2 + x
(ii) 2 - x2 + x3
(iii) $$frac{π}{2}$x2 + x$iv) √2x - 1

Solution

(i) 2 + x2 + x
The coefficient of x2 is 1.

(ii) 2 - x2 + x3
The coefficient of x2 is -1.

(iii) $$frac{π}{2}$x2 + x The coefficient of x2 is $\frac{π}{2}$.$iv) √2x - 1
The coefficient of x2 is 0.

3. Question 3

Give one example each of a binomial of degree 35, and of a monomial of degree 100.

Binomial of degree 35 :- P(x) = x35 + x34

Monomial of degree 100 :- Q(y) = y100

4. Question 4

Write the degree of each of the following polynomials:
(i) 5x3 + 4x2 + 7x
(ii) 4 – y2
(iii) 5t - √7
(iv) 3

Solution

(i) 5x3 + 4x2 + 7x
The highest power of x in the polynomial is 3.
The degree of the polynomial is 3.

(ii) 4 – y2
The highest power of y in the polynomial is 2.
The degree of the polynomial is 2.

(iii) 5t - √7
The highest power of t in the polynomial is 1.
The degree of the polynomial is 1.

(iv) 3
There is no variable in the polynomial.
The degree of the polynomial is 0.

5. Question 5

Classify the following as linear, quadratic and cubic polynomials:
(i) x2 + x
(ii) x – x3
(iii) y + y2 + 4
(iv) 1 + x
(v) 3t
(vi) r2
(vii) 7x3

Solution

(i) x2 + x
The highest power of x in the polynomial is 2.
Therefore the following polynomial is quadratic.

(ii) x – x3
The highest power of x in the polynomial is 3.
Therefore the following polynomial is cubic.

(iii) y + y2 + 4
The highest power of y in the polynomial is 2.
Therefore the following polynomial is quadratic.

(iv) 1 + x
The highest power of x in the polynomial is 1.
Therefore the following polynomial is linear.

(v) 3t
The highest power of t in the polynomial is 1.
Therefore the following polynomial is linear.

(vi) r2
The highest power of r in the polynomial is 2.
Therefore the following polynomial is quadratic.

(vii) 7x3
The highest power of x in the polynomial is 3.
Therefore the following polynomial is cubic.

Free CBSE Online CoachingClass 9 Maths

Register in 2 easy steps and
Start learning in 5 minutes!

NCERT Solutions ForClass 9 Math

WhatsApp: WhatsApp Now
Email: learn@maxtute.com


text:
## Pages

### What does a 4-dimensional space look like?

We often hear people in physics and mathematics talking about 4-dimensional, 5-dimensional spaces, etc... so what are those spaces? how do we picture these high dimensional spaces?

### Similar triangles

Today, we are going to learn about similar triangles. We will use similar triangles to give a proof of Pythagorean Theorem.

### Caveman's multiplication

Today, I am going to tell you a method of doing multiplication by the ancients. I do not remember the name of this method, nor do I know when this method was invented. Let us just call it "the cave-man's multiplication method"!

### Morley's Theorem

In a triangle $ABC$, draw the trisectors of the angles $A$, $B$, $C$. These trisectors intersect at $A'$, $B'$ and $C'$ as in the figure below. Prove that the triangle $A'B'C'$ is an equilateral triangle.


text:
# State operator correpondence and $S^1 \times S^1$ to $R^2$

+ 2 like - 0 dislike
120 views

I want to know the "state operator correspondence" in detail.

What i want to know is the correspondence of SS1 to R2 How the states and the operator match to each other?

I know that for SS1 via radial quantization one circle plays a role for time, which produce the states.

And for R2, we have operators.

But i don't know how these two (states in SS1 and operators in R2) match each other. Can you explain this in detail? (Recommendation of any references will be helpful to me!)

This post is imported from Physics StackExchange at 2016-06-02 04:57 (UTC) posted by SE User phy_math, SE users associated with first three comments below are ACuriousMind, phy_math and ACuriousMind respectively.

 Please use answers only to (at least partly) answer questions. To comment, discuss, or ask for clarification, leave a comment instead. To mask links under text, please type your text, highlight it, and click the "link" button. You can then enter your link URL. Please consult the FAQ for as to how to format your post. This is the answer box; if you want to write a comment instead, please use the 'add comment' button. Live preview (may slow down editor)   Preview Your name to display (optional): Email me at this address if my answer is selected or commented on: Privacy: Your email address will only be used for sending these notifications. Anti-spam verification: If you are a human please identify the position of the character covered by the symbol $\varnothing$ in the following word:p$\varnothing$ysicsOverflowThen drag the red bullet below over the corresponding character of our banner. When you drop it there, the bullet changes to green (on slow internet connections after a few seconds). To avoid this verification in future, please log in or register.


text:
# Continuous Random Variable

(Redirected from continuous random variable)

A Continuous Random Variable ($X$) is a random variable that represents a continuous random experiment whose function range is an uncountable interval.

## References

### 2013

• (Wikipedia, 2013) ⇒ http://en.wikipedia.org/wiki/Random_variable#Real-valued_random_variables
• In this case the observation space is the real numbers. Recall, $(\Omega, \mathcal{F}, P)$ is the probability space. For real observation space, the function $X\colon \Omega \rightarrow \mathbb{R}$ is a real-valued random variable if :$\{ \omega : X(\omega) \le r \} \in \mathcal{F} \qquad \forall r \in \mathbb{R}.$ This definition is a special case of the above because the set $\{(-\infty, r]: r \in \R\}$ generates the Borel σ-algebra on the real numbers, and it suffices to check measurability on any generating set. Here we can prove measurability on this generating set by using the fact that $\{ \omega : X(\omega) \le r \} = X^{-1}((-\infty, r])$.

### 2009

• (Wikipedia, 2009) ⇒ http://en.wikipedia.org/wiki/Random_variable#Formal_definition
• Let (Ω, \mathcal{F}, P) be a probability space and (\mathcal{}Y, \Sigma) be a measurable space. Then a random variable X is formally defined as a measurable function X: \Omega \rightarrow Y. An interpretation of this is that the preimages of the "well-behaved" subsets of Y (the elements of Σ) are events (elements of \mathcal{F}), and hence are assigned a probability by P.

### 1986

• (Larsen & Marx, 1986) ⇒ Richard J. Larsen, and Morris L. Marx. (1986). “An Introduction to Mathematical Statistics and Its Applications, 2nd edition." Prentice Hall
• 'Definition 3.2.1. A real-valued function whose domain is the sample space S is called a random variable. We denote random variables by uppercase letters, often $X$, Y, or Z.
• If the range of the mapping contains either a finite or countably infinite number of values, the random variable is said to be discrete ; if the range includes an interval of real numbers, bounded or unbounded, the random variable is said to be continuous.
• ...
• Associated with each continuous random variable $Y$ is also a probability density function, fY(y), but fY(y) in this case is not the probability that the random variable $Y$ takes on the value y. Rather, fY(y) is a continuous curve having the property that for all $a$ and $b$,
• P(a$Y$b) = P({s(∈)S| $a$Y(s) ≤ b}) = Integral(a,b). “fY(y) dy]


text:
# A short introduction to cross-network analysis with xnet

## Concepts and terms used in the package.

### Notation and naming of networks in the package

Networks exist in all forms and shapes. xnet is a simple, but powerful package to predict edges in networks in a supervised fashion. For example:

• which proteins interact with eachother?
• which goods are bought by which clients?
• how many likes give Twitter users to each other’s tweets?

The two sets can contain the same types nodes (e.g. protein interaction networks) or different nodes (e.g. goods bought by clients in a recommender system). When the two sets are the same, we call this a homogeneous network. A network between two different sets of nodes is called a heterogeneous network.

The interactions are presented in a adjacency matrix, noted Y. The rows of Y represent one set of nodes, the columns the second. Interactions can be measured on a continuous scale, indicating how strong each interaction is. Often the adjacency matrix only contains a few values: 1 for interaction, 0 for no interaction and possibly -1 for an inverse interaction.

Two-step kernel ridge regression ( function tskrr() ) predicts the values in the adjacency matrix based on similarities within the node sets, calculated by using some form of a kernel function. This function takes two nodes as input, and outputs a measure of similarity with specific mathematical properties. The resulting kernel matrix has to be positive definite for the method to work. In the package, these matrices are noted K for the rows and - if applicable - G for the columns of Y.

We refer to the kernlab for a collection of different kernel functions.

### Data in the package

For the illustrations, we use two different datasets.

#### Homogeneous networks

The example dataset proteinInteraction originates from a publication by Yamanishi et al (2004). It contains data on interaction between a subset of 769 proteins, and consists of two objects:

• the adjacency matrix proteinInteraction where 1 indicates an interaction between proteins
• the kernel matrix Kmat_y2h_sc describing the similarity between the proteins.

#### Heterogeneous networks

The dataset drugtarget serves as an example of a heterogeneous network and comes from a publication of Yamanishi et al (2008). In order to get a correct kernel matrix, we recalculated the kernel matrices as explained in the vignette Preparation of the example data.

The dataset exists of three objects

• the adjacency matrix drugTargetInteraction
• the kernel matrix for the targets targetSim
• the kernel matrix for the drugs drugSim

The adjacency matrix indicates which protein targets interact with which drugs, and the purpose is to predict new drug-target interactions.

## Fitting a two-step kernel ridge regression

### Heterogeneous network

To fit a two-step kernel ridge regression, you use the function tskrr(). This function needs to get some tuning parameter(s) lambda. You can choose to set 1 lambda for tuning K and G using the same lambda value, or you can specify a different lambda for K and G.

data(drugtarget)

drugmodel <- tskrr(y = drugTargetInteraction,
k = targetSim,
g = drugSim,
lambda = c(0.01,0.1))

drugmodel
#> Heterogeneous two-step kernel ridge regression
#> ---------------------------------------------
#> Dimensions: 26 x 54
#> Lambda:
#>    k    g
#> 0.01 0.10
#>
#> Row Labels:"hsa190" "hsa2099" "hsa2100" "hsa2101" "hsa2103" "hsa2104" ...
#> Col Labels:"D00040" "D00066" "D00067" "D00075" "D00088" "D00094" ...

### Homogeneous network

For homogeneous networks you use the same function, but you don’t specify the G matrix. You also need only a single lambda:

data(proteinInteraction)

proteinmodel <- tskrr(proteinInteraction,
k = Kmat_y2h_sc,
lambda = 0.01)

proteinmodel
#> Homogeneous two-step kernel ridge regression
#> -------------------------------------------
#> Dimensions: 150 x 150
#> Lambda:
#>    k
#> 0.01
#>
#> Labels:"YER171W" "YEL002C" "YJL210W" "YBR097W" "YHR174W" ...

### Extracting parameters from a trained model.

The model output itself tells you only little, apart from the dimensions, the lambdas used and the labels found in the data. That information can be extracted using a number of convenient functions.

lambda(drugmodel)  # extract lambda values
#>    k    g
#> 0.01 0.10
lambda(proteinmodel)
#>    k
#> 0.01
dim(drugmodel) # extract the dimensions
#> [1] 26 54

protlabels <- labels(proteinmodel)
str(protlabels)
#> List of 2
#>  $k: chr [1:150] "YER171W" "YEL002C" "YJL210W" "YBR097W" ... #>$ g: chr [1:150] "YER171W" "YEL002C" "YJL210W" "YBR097W" ...
• lambda returns a vector with the lambda values used.
• dim returns the dimensions.
• labels returns a list with two elements, k and g, containing the labels for the rows resp. the columns.

You can also use the functions rownames() and colnames() to extract the labels.

### Information on the fit of the model

The functions fitted() and predict() can be used to extract the fitted values. The latter also allows you to specify new kernel matrices to predict for new nodes in the network. To obtain the residuals, you can use the function residuals(). This is shown further in the document.

## Performing leave-one-out cross-validation

### Settings for LOO

The most significant contribution of this package, are the various shortcuts for leave-one-out cross-validation (LOO-CV) described in the paper by Stock et al, 2018. Generally LOO-CV removes a value, refits the model and predicts the removed value based on this refit model. In this package you do this using the function loo(). The paper describes a number of different settings, which can be passed to the argument exclusion:

• interaction: in this setting only the interaction between two nodes is removed from the adjacency matrix.
• row: in this setting the entire row for that node is removed from the adjacency matrix. This boils down to removing a node from the set described by K.
• column: in this setting the entire column for that node is removed from the adjacency matrix. This boils down to removing a node from the set decribed by G.
• both: in this setting both rows and columns are removed, i.e. for every loo value the respective nodes are removed from both sets.

For some networks, only information of interactions is available, so a 0 does not necessarily indicate “no interaction”. It just indicates “no knowledge” for an interaction. In those cases it makes more sense to calculate the LOO values by replacing the interaction by 0 instead of removing it. This can be done by setting replaceby0 = TRUE.

loo_drugs_interaction <- loo(drugmodel, exclusion = "interaction",
replaceby0 = TRUE)
loo_protein_both <- loo(proteinmodel, exclusion = "both")

In both cases the result is a matrix with the LOO values.

### Use LOO in other functions

There are several functions that allow to use the LOO values instead of predictions for model tuning and validation. For example, you can calculate residuals based on LOO values directly using the function residuals():

loo_resid <- residuals(drugmodel, method = "loo",
exclusion = "interaction",
replaceby0 = TRUE)
all.equal(loo_resid,
response(drugmodel) - loo_drugs_interaction )
#> [1] TRUE

Every other function that can use LOO values instead of predictions will have the same two arguments exclusion and replaceby0.

## Looking at model output

The function provides a plot() function for looking at the model output. This function can show you the fitted values, LOO values or the residuals. It also lets you construct dendrograms based on distances computed using the K and G matrices, so you have both the predictions and the similarity information on the nodes in one plot.

plot(drugmodel, main = "Drug Target interaction")

To plot LOO values, you set the argument which. As the protein model is pretty extensive, we can remove the dendrogram and select a number of proteins we want to inspect closer.

plot(proteinmodel, dendro = "none", main = "Protein interaction - LOO",
which = "loo", exclusion = "both",
rows = rownames(proteinmodel)[10:20],
cols = colnames(proteinmodel)[30:35])

If the colors don’t suit you, you can set both the breaks used for the color code and the color code itself.

plot(drugmodel, which = "residuals",
col = rainbow(20),
breaks = seq(-1,1,by=0.1))

## Tuning a model to find the best lambda.

In most cases you don’t know how to set the lambda values for optimal predictions. In order to find the best lambda values, the function tune() allows you to do a grid search. This grid search can be done in a number of ways:

• by specifying actual values to be tested
• by specifying the minimum and maximum lambda together with the number of values needed in every dimension. The function will create a grid that’s even spaced on a log scale.

Tuning minimizes a loss function. Two loss functions are provided, i.e. one based on mean squared error (loss_mse) and one based on the area under the curve (loss_auc). But you can provide your own loss function too, if needed.

### Homogeneous networks

Homogeneous networks have a single lambda value, and should hence only search in a single dimension. The following code tests 20 lambda values between 0.001 and 10.

proteintuned <- tune(proteinmodel,
lim = c(0.001,10),
ngrid = 20,
fun = loss_auc)
proteintuned
#> Tuned homogeneous two-step kernel ridge regression
#> -------------------------------------------------
#> Dimensions: 150 x 150
#> Lambda:
#>           k
#> 0.001623777
#>
#> Labels:"YER171W" "YEL002C" "YJL210W" "YBR097W" "YHR174W" ...
#>
#> Tuning information:
#> -------------------
#> exclusion setting: edges
#> loss value: 0.3294548
#> loss function: Area under curve (loss_auc)

The returned object is a again a model object with the model fitted using the best lambda value. It also contains extra information on the settings of the tuning. You can extract the grid values as follows:

get_grid(proteintuned)
#> $k #> [1] 0.001000000 0.001623777 0.002636651 0.004281332 0.006951928 #> [6] 0.011288379 0.018329807 0.029763514 0.048329302 0.078475997 #> [11] 0.127427499 0.206913808 0.335981829 0.545559478 0.885866790 #> [16] 1.438449888 2.335721469 3.792690191 6.158482111 10.000000000 This returns a list with one or two elements, each element containing the grid values for the respective kernel matrix. You can also create a plot to visually inspect the tuning: plot_grid(proteintuned) This object is also a tskrr model, so all the functions used above can be used here as well. For example, we can use the same code as before to inspect the LOO values of this tuned model: plot(proteintuned, dendro = "none", main = "Protein interaction - LOO", which = "loo", exclusion = "both", rows = rownames(proteinmodel)[10:20], cols = colnames(proteinmodel)[30:35]) ### Heterogeneous networks For heterogeneous networks, the tuning works the same way. Standard, the function tune() performs a two-dimensional grid search. To do a one-dimensional grid search (i.e. use the same lambda for K and G), you set the argument onedim = TRUE. drugtuned1d <- tune(drugmodel, lim = c(0.001,10), ngrid = 20, fun = loss_auc, onedim = TRUE) plot_grid(drugtuned1d, main = "1D search") When performing a two-dimensional grid search, you can specify different limits and grid values or lambda values for both dimensions. You do this by passing a list with two elements for the respective arguments. drugtuned2d <- tune(drugmodel, lim = list(k = c(0.001,10), g = c(0.0001,10)), ngrid = list(k = 20, g = 10), fun = loss_auc) the plot_grid() function will give you a heatmap indicating where the optimal lambda values are found: plot_grid(drugtuned2d, main = "2D search") As before, you can use the function lambda() to get to the best lambda values. lambda(drugtuned1d) #> k g #> 0.3359818 0.3359818 lambda(drugtuned2d) #> k g #> 0.2069138 0.2154435 A one-dimensional grid search give might yield quite different optimal lambda values. To get more information on the loss values, the function get_loss_values() can be used. This allows you to examine the actual improvement for every lambda value. The output is always a matrix, and in the case of a 1D search it’s a matrix with one column. Combining these values with the lambda grid, shows that the the difference between a lambda value of around 0.20 and around 0.34 is very small. This is also obvious from the grid plots shown above. cbind( loss = get_loss_values(drugtuned1d)[,1], lambda = get_grid(drugtuned1d)$k
)[10:15,]
#>           loss    lambda
#> [1,] 0.1275495 0.0784760
#> [2,] 0.1239134 0.1274275
#> [3,] 0.1219094 0.2069138
#> [4,] 0.1217656 0.3359818
#> [5,] 0.1238880 0.5455595
#> [6,] 0.1271689 0.8858668

## Predicting new values

In order to predict new values, you need information on the outcome of the kernel functions for the combination of the new values and those used to train the model. Depending on which information you have, you can do different predictions. To illustrate this, we split up the data for the drugsmodel.

idk_test <- c(5,10,15,20,25)
idg_test <- c(2,4,6,8,10)

drugInteraction_train <- drugTargetInteraction[-idk_test, -idg_test]
target_train <- targetSim[-idk_test, -idk_test]
drug_train <- drugSim[-idg_test, -idg_test]

target_test <- targetSim[idk_test, -idk_test]
drug_test <- drugSim[idg_test, -idg_test]

So the following drugs and targets are removed from the training data and will be used for predictions later:

rownames(target_test)
#> [1] "hsa2103" "hsa4306" "hsa5915" "hsa6256" "hsa9970"
colnames(drug_test)
#>  [1] "D00040" "D00067" "D00088" "D00105" "D00143" "D00182" "D00187" "D00188"
#>  [9] "D00211" "D00246" "D00279" "D00299" "D00312" "D00316" "D00327" "D00348"
#> [17] "D00443" "D00462" "D00506" "D00554" "D00565" "D00577" "D00585" "D00586"
#> [25] "D00596" "D00627" "D00690" "D00730" "D00898" "D00930" "D00950" "D00951"
#> [33] "D00954" "D00956" "D00961" "D00962" "D00965" "D01115" "D01132" "D01161"
#> [41] "D01217" "D01294" "D01387" "D01441" "D01689" "D02217" "D02367" "D04066"
#> [49] "D05341"

We can now train the data using tune() just like we would use tskrr()

trained <- tune(drugInteraction_train,
k = target_train,
g = drug_train,
ngrid = 30)

### Predict for new K-nodes

In order to predict the interaction between new targets and the drugs in the model, we need to pass the kernel values for the similarities between the new targets and the ones in the model. The predict() function will select the correct G matrix for calculating the predictions.

Newtargets <- predict(trained, k = target_test)
Newtargets[, 1:5]
#>              D00040     D00067      D00088     D00105      D00143
#> hsa2103 0.004057079 0.03081055 0.009556427 0.04742997 0.008212541
#> hsa4306 0.001703995 0.02759991 0.175792592 0.04809118 0.024805465
#> hsa5915 0.023949572 0.01421044 0.008865099 0.01646451 0.016024808
#> hsa6256 0.010536788 0.02970235 0.018628412 0.03806541 0.003662778
#> hsa9970 0.015759320 0.02500044 0.035086840 0.04464471 0.181819822

### Predict for new G-nodes

If you want to predict for new drugs, you need the kernel values for the similarities between new drugs and the drugs trained in the model.

Newdrugs <- predict(trained, g = drug_test)
Newdrugs[1:5, ]
#>                D00066       D00075       D00094        D00129        D00163
#> hsa190   0.0004385072 3.910979e-05 0.0000317464  5.801116e-04  0.0003651196
#> hsa2099  0.0268199330 3.264114e-01 0.0227098621 -1.072246e-01  0.0623070092
#> hsa2100 -0.0289764612 3.207540e-01 0.0147790518 -1.264217e-01 -0.1383998327
#> hsa2101 -0.0048777886 1.309579e-02 0.0090779102  4.106452e-06 -0.0593089366
#> hsa2104 -0.0051459974 1.258277e-02 0.0095775683  1.577701e-05 -0.0596787553

### Predict for new K and G nodes

You can combine both kernel matrices used above to get predictions about the interaction between new drugs and new targets:

Newdrugtarget <- predict(trained, k=target_test, g=drug_test)
Newdrugtarget
#>                D00066     D00075       D00094       D00129        D00163
#> hsa2103  7.715195e-03 0.02921056 -0.012015102  0.008404732 -4.006168e-02
#> hsa4306  1.134892e-01 0.13809671  0.002077053 -0.024120960  2.336087e-02
#> hsa5915 -1.173301e-05 0.02535359  0.423718351  0.012963952 -1.475475e-02
#> hsa6256  2.490618e-02 0.03032823  0.063798137  0.005722959  5.630761e-05
#> hsa9970  5.919073e-02 0.02541274  0.031471514  0.135712388  5.288650e-02

## Impute new values based on a tskrr model

Sometimes you have missing values in a adjacency matrix. These missing values can be imputed based on a simple algorithm:

1. replace the missing values by a start value
2. fit a tskrr model with the added values
3. replace the missing values with the predictions of that model
4. repeat until the imputed values converge (i.e. the difference with the previous run falls below a tolerance value)

Apart from the usual arguments of tskrr, you can give additional parameters to the function impute_tskrr. The most important ones are

• niter: the maximum number of iterations
• tol: the tolerance, i.e. the minimal sum of squared differences between iteration steps to keep the algorithm going
• verbose: setting this to 1 or 2 gives additional info on the algorithm performance.

So let’s construct a dataset with missing values:

drugTargetMissing <- drugTargetInteraction
idmissing <- c(10,20,30,40,50,60)
drugTargetMissing[idmissing] <- NA

Now we can try to impute these values. The outcome is again a tskrr model.

imputed <- impute_tskrr(drugTargetMissing,
k = targetSim,
g = drugSim,
verbose = TRUE)
#> Nr. of iterations: 80 - Deviation:1.4900616992948e-08
plot(imputed, dendro = "none")

To extract information on the imputation, you have a few convenience functions to your disposal:

• has_imputed_values() tells you whether the model contains imputed values
• is_imputed() returns a logical matrix where TRUE indicates an imputed value
• which_imputed() returns an integer vector with the positions of the imputed values. Note that these positions are vector positions, i.e. they give the position in a single dimension (according to how a matrix is stored internally in R.)
has_imputed_values(imputed)
#> [1] TRUE
which_imputed(imputed)
#> [1] 10 20 30 40 50 60

# Extract only the imputed values
id <- is_imputed(imputed)
predict(imputed)[id]
#> [1]  0.17454499  0.03111647 -0.01402729 -0.03812844  0.28626726  0.06590431

You can use this information to plot the imputed values in context:

rowid <- rowSums(id) > 0
colid <- colSums(id) > 0
plot(imputed, rows = rowid, cols = colid)


text:
# Random sampling of lattice paths with constraints, via transportation

Abstract : We build and analyze in this paper Markov chains for the random sampling of some one-dimensional lattice paths with constraints, for various constraints. These chains are easy to implement, and sample an "almost" uniform path of length $n$ in $n^{3+\epsilon}$ steps. This bound makes use of a certain $\textit{contraction property}$ of the Markov chain, and is proved with an approach inspired by optimal transport.
Keywords :
Type de document :
Communication dans un congrès
Drmota, Michael and Gittenberger, Bernhard. 21st International Meeting on Probabilistic, Combinatorial, and Asymptotic Methods in the Analysis of Algorithms (AofA'10), 2010, Vienna, Austria. Discrete Mathematics and Theoretical Computer Science, DMTCS Proceedings vol. AM, 21st International Meeting on Probabilistic, Combinatorial, and Asymptotic Methods in the Analysis of Algorithms (AofA'10), pp.317-328, 2010, DMTCS Proceedings
Domaine :

Littérature citée [14 références]

https://hal.inria.fr/hal-00439479
Contributeur : Coordination Episciences Iam <>
Soumis le : jeudi 20 août 2015 - 16:32:59
Dernière modification le : mardi 23 janvier 2018 - 16:00:02
Document(s) archivé(s) le : mercredi 26 avril 2017 - 09:48:42

### Fichier

dmAM0122.pdf
Fichiers éditeurs autorisés sur une archive ouverte

### Identifiants

• HAL Id : hal-00439479, version 4

### Citation

Lucas Gerin. Random sampling of lattice paths with constraints, via transportation. Drmota, Michael and Gittenberger, Bernhard. 21st International Meeting on Probabilistic, Combinatorial, and Asymptotic Methods in the Analysis of Algorithms (AofA'10), 2010, Vienna, Austria. Discrete Mathematics and Theoretical Computer Science, DMTCS Proceedings vol. AM, 21st International Meeting on Probabilistic, Combinatorial, and Asymptotic Methods in the Analysis of Algorithms (AofA'10), pp.317-328, 2010, DMTCS Proceedings. 〈hal-00439479v4〉

### Métriques

Consultations de la notice

## 87

Téléchargements de fichiers


text:
scipy.stats.rankdata¶

scipy.stats.rankdata(a, method='average', *, axis=None)[source]

Assign ranks to data, dealing with ties appropriately.

By default (axis=None), the data array is first flattened, and a flat array of ranks is returned. Separately reshape the rank array to the shape of the data array if desired (see Examples).

Ranks begin at 1. The method argument controls how ranks are assigned to equal values. See [1] for further discussion of ranking methods.

Parameters
aarray_like

The array of values to be ranked.

method{‘average’, ‘min’, ‘max’, ‘dense’, ‘ordinal’}, optional

The method used to assign ranks to tied elements. The following methods are available (default is ‘average’):

• ‘average’: The average of the ranks that would have been assigned to all the tied values is assigned to each value.

• ‘min’: The minimum of the ranks that would have been assigned to all the tied values is assigned to each value. (This is also referred to as “competition” ranking.)

• ‘max’: The maximum of the ranks that would have been assigned to all the tied values is assigned to each value.

• ‘dense’: Like ‘min’, but the rank of the next highest element is assigned the rank immediately after those assigned to the tied elements.

• ‘ordinal’: All values are given a distinct rank, corresponding to the order that the values occur in a.

axis{None, int}, optional

Axis along which to perform the ranking. If None, the data array is first flattened.

Returns
ranksndarray

An array of size equal to the size of a, containing rank scores.

References

1

“Ranking”, https://en.wikipedia.org/wiki/Ranking

Examples

>>> from scipy.stats import rankdata
>>> rankdata([0, 2, 3, 2])
array([ 1. ,  2.5,  4. ,  2.5])
>>> rankdata([0, 2, 3, 2], method='min')
array([ 1,  2,  4,  2])
>>> rankdata([0, 2, 3, 2], method='max')
array([ 1,  3,  4,  3])
>>> rankdata([0, 2, 3, 2], method='dense')
array([ 1,  2,  3,  2])
>>> rankdata([0, 2, 3, 2], method='ordinal')
array([ 1,  2,  4,  3])
>>> rankdata([[0, 2], [3, 2]]).reshape(2,2)
array([[1. , 2.5],
[4. , 2.5]])
>>> rankdata([[0, 2, 2], [3, 2, 5]], axis=1)
array([[1. , 2.5, 2.5],
[2. , 1. , 3. ]])

Previous topic

scipy.stats.tiecorrect

Next topic

scipy.stats.ranksums


text:
# [tex4ht] what is the fastest way to convert large document to HTML?

Nasser M. Abbasi nma at 12000.org
Thu Aug 16 14:12:29 CEST 2018

I am still struggling with very slow latex to HTML conversion
for large document with lots of math.

using svg for math, the bottleneck is always dvisvgm.

For a document of 4,000 pages, with about 50,000 math expressions, it
takes 8 hrs on Linux in a Vbox and 2.5 hrs on PC running Linux. It
takes less than 2 minutes to compile it using lualatex to PDF.

So I want to get away from dvisvgm. Using png for math is no
better. Still just as slow.

What other options are there using tex4ht to speed the
process of conversion that I could try? Even if the quality of
math is not as good as svg.

I am only familiar with using svg and png for math images. But
I know tex4ht supports other formats and also mathjax.  I now
use make4ht to compile.

Any suggestion what else to try that will be much faster?

I can't spend 5-10 hrs each time waiting for document to compile
to HTML each time I make small change.

Thanks
--Nasser


text:
Conference paper Open Access

# Continuous Wavelet Vocoder-Based Decomposition of Parametric Speech Waveform Synthesis

Al-Radhi, Mohammed Salah; Csapó, Tamás Gábor; Németh, Géza

### DataCite XML Export

<?xml version='1.0' encoding='utf-8'?>
<identifier identifierType="URL">https://zenodo.org/record/5730361</identifier>
<creators>
<creator>
<givenName>Mohammed Salah</givenName>
<nameIdentifier nameIdentifierScheme="ORCID" schemeURI="http://orcid.org/">0000-0003-3094-6916</nameIdentifier>
<affiliation>Budapest University of Technology and Economics</affiliation>
</creator>
<creator>
<creatorName>Csapó, Tamás Gábor</creatorName>
<givenName>Tamás Gábor</givenName>
<familyName>Csapó</familyName>
<nameIdentifier nameIdentifierScheme="ORCID" schemeURI="http://orcid.org/">0000-0003-4375-7524</nameIdentifier>
<affiliation>Budapest University of Technology and Economics</affiliation>
</creator>
<creator>
<creatorName>Németh, Géza</creatorName>
<givenName>Géza</givenName>
<familyName>Németh</familyName>
<nameIdentifier nameIdentifierScheme="ORCID" schemeURI="http://orcid.org/">0000-0002-2311-4858</nameIdentifier>
<affiliation>Budapest University of Technology and Economics</affiliation>
</creator>
</creators>
<titles>
<title>Continuous Wavelet Vocoder-Based Decomposition of Parametric Speech Waveform Synthesis</title>
</titles>
<publisher>Zenodo</publisher>
<publicationYear>2021</publicationYear>
<subjects>
<subject>wavelet model</subject>
<subject>speech synthesis</subject>
<subject>statistical features</subject>
<subject>continuous vocoder</subject>
</subjects>
<dates>
<date dateType="Issued">2021-09-03</date>
</dates>
<language>en</language>
<resourceType resourceTypeGeneral="ConferencePaper"/>
<alternateIdentifiers>
<alternateIdentifier alternateIdentifierType="url">https://zenodo.org/record/5730361</alternateIdentifier>
</alternateIdentifiers>
<relatedIdentifiers>
<relatedIdentifier relatedIdentifierType="DOI" relationType="IsIdenticalTo">10.21437/Interspeech.2021-1600</relatedIdentifier>
<relatedIdentifier relatedIdentifierType="URL" relationType="IsPartOf">https://zenodo.org/communities/ai4eu</relatedIdentifier>
</relatedIdentifiers>
<version>1</version>
<rightsList>
<rights rightsURI="info:eu-repo/semantics/openAccess">Open Access</rights>
</rightsList>
<descriptions>
<description descriptionType="Abstract">
To date, various speech technology systems have adopted the vocoder approach, a method for synthesizing speech waveform that shows a major role in the performance of statistical parametric speech synthesis. However, conventional sourcefilter systems (i.e., STRAIGHT) and sinusoidal models (i.e., MagPhase) tend to produce over-smoothed spectra, which often result in muffled and buzzy synthesized text-to-speech (TTS). WaveNet, one of the best models that nearly resembles the human voice, has to generate a waveform in a time-consuming sequential manner with an extremely complex structure of its neural networks. WaveNet needs large quantities of voice data before accurate predictions can be obtained. In order to motivate a new, alternative approach to these issues, we present an updated synthesizer, which is a simple signal model to train and easy to generate waveforms, using Continuous Wavelet Transform (CWT) to characterize and decompose speech features. CWT provides time and frequency resolutions different from those of the short-time Fourier transform. It can also retain the fine spectral envelope and achieve high controllability of the structure closer to human auditory scales. We confirmed through experiments that our speech synthesis system was able to provide natural-sounding synthetic speech and outperformed the state-of-the-art WaveNet vocoder.
</description>
</descriptions>
<fundingReferences>
<fundingReference>
<funderName>European Commission</funderName>
<funderIdentifier funderIdentifierType="Crossref Funder ID">10.13039/100010661</funderIdentifier>
<awardNumber awardURI="info:eu-repo/grantAgreement/EC/H2020/825619/">825619</awardNumber>
<awardTitle>A European AI On Demand Platform and Ecosystem</awardTitle>
</fundingReference>
</fundingReferences>
</resource>

21
19
views


text:
## Fundamentals of Physics Extended (10th Edition)

$+30cm$
We can use the values given on table 34-5 in equation 34-8 to find the radius of the mirror, $r$. $\frac{n_1}{p}+\frac{n_2}{i}=\frac{n_2-n_1}{r}$ Solving for r, we obtain: $r=(\frac{n_1}{p}+\frac{n_2}{i})^{-1}*(n_2-n_1)$ $r=(\frac{1.5}{10cm}+\frac{1.0}{-6.0cm})^{-1}*(1.0-1.5)$ $r=+30cm$


text:
#### Authors

Pierre Garrigues, Laurent Ghaoui

#### Abstract

It has been shown that the problem of $\ell_1$-penalized least-square regression commonly referred to as the Lasso or Basis Pursuit DeNoising leads to solutions that are sparse and therefore achieves model selection. We propose in this paper an algorithm to solve the Lasso with online observations. We introduce an optimization problem that allows us to compute an homotopy from the current solution to the solution after observing a new data point. We compare our method to Lars and present an application to compressed sensing with sequential observations. Our approach can also be easily extended to compute an homotopy from the current solution to the solution after removing a data point, which leads to an efficient algorithm for leave-one-out cross-validation.


text:
# 6.4.11. Type-level data declarations¶

TypeData
Since: 9.6.1

Allow type data declarations, which define constructors at the type level.

This extension facilitates type-level (compile-time) programming by allowing a type-level counterpart of data declarations, such as this definition of type-level natural numbers:

type data Nat = Zero | Succ Nat

This is similar to the corresponding data declaration, except that the constructors Zero and Succ it introduces belong to the type constructor namespace, so they can be used in types, such as the type of length-indexed vectors:

data Vec :: Type -> Nat -> Type where
Nil  :: Vec a Zero
Cons :: a -> Vec a n -> Vec a (Succ n)

TypeData is a more fine-grained alternative to the DataKinds extension, which defines all the constructors in all data declarations as both data constructors and type constructors.

A type data declaration has the same syntax as a data declaration, either an ordinary algebraic data type or a GADT, prefixed with the keyword type, except that it may not contain a datatype context (even with DatatypeContexts), labelled fields, strictness flags, or a deriving clause.

The only constraints permitted in the types of constructors are equality constraints, e.g.:

type data P :: Type -> Type -> Type where
MkP :: (a ~ Natural, b ~~ Char) => P a b

Because type data declarations introduce type constructors, they do not permit constructors with the same names as types, so the following declaration is invalid:

type data T = T     // Invalid

The compiler will reject this declaration, because the type constructor T is defined twice (as the datatype being defined and as a type constructor).

The main type constructor of a type data declaration can be defined recursively, as in the Nat example above, but its constructors may not be used in types within the same mutually recursive group of declarations, so the following is forbidden:

type data T f = K (f (K Int))  // Invalid