## How to super impose a curve onto a 2-D contour plot

I have created a smooth color gradient 2-D contour plot with existing compiled data. I have an x-axis, y-axis, and z-data contour plotted as a colormap. I have a single value of z-data that I want to plot as a curve onto the colormap.

x = 0.05:0.05:1; y = 0.0:0.05:1; [X, Y] = meshgrid(x, y); Z = [data] contourf(X, Y, Z); pcolor(X, Y, Z); shading interp title() xlabel() ylabel() colorbar 

## Perron’s formula where the integrand of the contour is badly behaved at (and left of) zero

I am attempting to use Perron’s formula to recover the asymptotic form of a summatory function. Namely, it can be shown (is not difficult to prove) that for the prime omega function, $$\omega(n)$$, its Dirichlet series for $$\Re(s) > 1$$ is given by $$D_{\omega}(s) := \sum_{n \geq 1} \frac{\omega(n)}{n^s} = \zeta(s) P(s),$$ where $$P(s) := \sum_{p} p^{-s},\ \Re(s) > 1$$ is the prime zeta function. For example, this relation can be seen by showing that $$\prod_{p\mathrm{\ prime}} \left(1-\frac{u}{1-p^s}\right) = \sum_{n \geq 0} \frac{u^{\omega(n)}}{n^s},$$ and then differentiating with respect to $$u$$. So, in principle, I should have by Perron’s formula that $${\sum_{n \leq x}}^{\prime} \omega(n) = \frac{1}{2\pi\imath} \int_{c-\imath\infty}^{c+\imath\infty} D_{\omega}(s) \frac{x^s}{s} ds,$$ for suitably large, finite $$c > 1$$. But now we arrive at a BIG, nay HUGE, complication, which is that due to the nature of its singularities, it is well-known that $$P(s)$$ cannot be analytically continued at or to the left of zero! I still would like to be able to approximate the contour integral on the right-hand-side of the previous equation.

The next part of this is my attempt to enable this to happen within some not unreasonable added asymptotic error. Please help me to debug my working lemma to accomplish just this.

There are fairly standard bounds on the prime counting function, $$\pi(x)$$, for sufficiently large $$x \geq 17$$: $$\frac{x}{\log x} < \pi(x) < C \cdot \frac{x}{\log x}, C \approx 1.25506.$$ Now additionally, by a Mellin transform, we can write for all $$\Re(s) > 1$$ that $$P(s) = s \int_1^{\infty} \frac{\pi(x)}{x^{s+1}} dx,$$ which is not too bad to evaluate and estimate if we plug in the previous upper and lower bounds for $$\pi(x)$$. Thus my question (I would love to make a little lemma out of this) is the following:

Proposed Lemma: Suppose that $$|R_1(s)| < |P(s)| < |R_2(s)|,$$ for all $$\Re(s) > 1$$, and moreover, the functions $$R_1(s),R_2(s)$$ can both be analytically continued to the entire complex plane, with the exception of at finitely many poles where we consider these functions to be undefined. Then for large enough (but finite) real $$c > \sigma_P$$, do I obtain that the contour integrals are bounded as follows: $$\left\lvert \frac{1}{2\pi\imath} \int_{c-\imath\infty}^{c+\imath\infty} R_1(s) \zeta(s) \frac{x^s}{s} ds\right\rvert < {\sum_{n \leq x}}^{\prime} \omega(n) < \left\lvert \frac{1}{2\pi\imath} \int_{c-\imath\infty}^{c+\imath\infty} R_2(s) \zeta(s) \frac{x^s}{s} ds\right\rvert.$$ Are there any additional necessary conditions that need to be placed on the functions $$R_1(s),R_2(s)$$ to give truth to the previous inequalities?

Thanks in advance. I really do have a good application in mind for this lemma.

## How to add labels in a contour plot using ggplot2?

I’m doing a contour plot with ggplot2 and I’m trying to add the labels like this tutorial. However, always appears the following error:

Error in geom_text_contour(aes(z = z)) : could not find function "geom_text_contour"

library(ggplot2)  x <- c(0,0,0,1,1,1,2,2,2,3,3,3) y <- c(0,1,2,0,1,2,0,1,2,0,1,2) z <- seq(0,11,1)  df <- data.frame(x,y,z)  ggplot(df, aes(x, y, z = z)) +   geom_tile(aes(fill = z)) +   geom_contour(colour = "white") +   geom_text_contour(aes(z = z)) 

## let $I_{p,q}=\int_{\gamma}p(z)\overline{q(z)}dz$ where $\gamma$ is the closed contour $\gamma(t)=e^{it},0\leq t \leq 2\pi.$ Then

Consider the polynomial $$p(z),q(z)$$ in the complex variable $$z$$ and let $$I_{p,q}=\int_{\gamma}p(z)\overline{q(z)}dz$$ where $$\gamma$$ is the closed contour $$\gamma(t)=e^{it},0\leq t \leq 2\pi.$$ Then

1. $$I_{z^m,z^n}=0,\forall m,n\in \mathbb Z^+,m\neq n$$

2. $$I_{z^n,z^n}=2\pi i,\forall n\in \mathbb Z^+$$

3. $$I_{p(z),1}=0,\forall$$ polynomials $$p$$

4. $$I_{p,q}=p(0)\overline{q(0)},\forall$$ polynomials $$p, q$$

My Attempt

When I flashed through the options, I got (3) as the answer. Since Polynomial function is analytic. By Cauchy’s theorem, $$\int_{\gamma}p(z)dz=0$$. option (1) is wrong. Since, If $$m-n+1=0$$, I got $$I_{z^m,z^n}=2\pi i$$. For option (2), $$I_{z^n,z^n}=\int_{\gamma}z^n\overline{z^n}dz=\int_0^2\pi 1.e^{it}i dt=2\pi i.$$ Using option (2), We can deduce that (4) is a wrong answer. But the answer given in the answer key is only (3). Can you please help me?

## Parallelise numerical integral for contour plot

I have the following integral that I would like to evaluate:

A[x_, y_] := 2/\[Pi] ((-1)^x y^x)/(2 - y)^(1 + x);  Pintegrand[m_, n_, r1_, r2_, \[Theta]1_, \[Theta]2_] := (A[m, \[Tau]] A[n, \[Sigma]])/(\[Pi]^2) r1 r2 LaguerreL[m, (4 r1^2)/(2 - \[Tau])] LaguerreL[n, (4 r2^2)/(2 - \[Sigma])] Exp[-((2 \[Tau] r1^2)/(2 - \[Tau]))] Exp[-((2 \[Sigma] r2^2)/(2 - \[Sigma]))] Exp[- (1/2) (-R2 + r2 Cos[\[Theta]2])^2 + (-I1 + r1 Sin[\[Theta]1]) (-((b (-R1 + r1 Cos[\[Theta]1]))/(-b^2 + a c)) + (a (-I1 + r1 Sin[\[Theta]1]))/(-b^2 + a c)) + (-R1 + r1 Cos[\[Theta]1]) ((c (-R1 + r1 Cos[\[Theta]1]))/(-b^2 + a c) - (b (-I1 + r1 Sin[\[Theta]1]))/(-b^2 + a c)) + (-I2 + r2 Sin[\[Theta]2])^2] // Simplify;  P11 = Integrate[Pintegrand[1, 1, r1, r2, \[Theta]1, \[Theta]2], {r1, 0, \[Infinity]}, {\[Theta]1, 0, 2 \[Pi]}, {r2, 0, \[Infinity]}, {\[Theta]2, 0, 2 \[Pi]}] 

The integrand function is the integrand of the integral, which is a Gaussian function weighted with the Laguerre polynomials (which is what is making the calculation lengthy).

I would like to generate a list of results with different values of $$m$$ and $$n$$ – that is P01, P10, P11, P12, P21, P22, P13, etc (first number corresponds to value of $$m$$ and second to $$n$$), with both $$m$$ and $$n$$ integers that each go from 0 to 10. I would like to use the result to create a contour plot of the result.

There are two post that request a similar objective, such as this and this. However the solutions appear to be specific to the integral in question and make use of different strategies, such as Parallelize, ParallelTable, and ParallelMap.

How can I most efficiently parallelise the numerical integral to generate a contour plot? Any help is appreciated!

## Integration of complex variables using Laurent series about a contour, C

I’ve got a homework question that I believe requires me to use Laurent series/method of residues.

The question itself is: Evaluate $$\int_C \frac{1}{z^2(z^2-16)}$$ where C is the contour $$|z| = 1$$. I’m confused by this question because it doesn’t say anything about the orientation of C. I’m ashamed to say I don’t even know how to approach this.

So far, I’ve tried breaking it into: $$\int_C \frac{1}{z^2} \frac{1}{z+4i} \frac{1}{z-4i}$$. But I don’t really know how to get the Taylor/Laurent series for these three pieces.

Am I approaching this in the right way?
Can somebody help me move forward?

Oops! I just realized that this is the wrong place to ask! Sorry!

## Algorithm for transforming an array of lines and arcs in a closed contour

I’m reading from a DXF with dxf_lib. In my DXFs there are different closed contours, what I do with dxf_lib is to estract information about every line and arc. I want to transorm a big array of lines and arcs, belonging to different contours, to arrays of ordered lines and arcs, one array for every closed contour. Do you have any suggestion on how to proceed?

## Calculate contour area of an object on image plane when the tilt angle of a camera have changed

The camera is always oriented in a way that lower border of HFOV (horizontal field of view) is aligned with bottom side of the object. Dimension of the object for reference camera tilt angle are given as well as contour area of this object on image plane. Parameters of camera (fields of view, focal length) are also known. Here is explaining image.

Is it possible to calculate new changed contour area on image plane when camera tilt angle is changed (due to changing object distance or/and camera height)?

I would be grateful if someone could point me to methods of calculations applicable here.

I have found such method as camera transform using pinhole camera model to represent object in 3d space on 2d plane, but seems that it is not what I am looking for.

## Calculate contour area of an object on image plane when the tilt angle of a camera have changed

The camera is always oriented in a way that lower border of HFOV is aligned with bottom side of the object. Dimensions of the object for reference camera tilt angle are given as well as contour area of this object on image plane. Parameters of camera (fields of view, focal length) are also known.

Is it possible to calculate new changed contour area of the object on image plane when camera tilt angle is changed (due to changing object distance or/and camera height)?

I would be grateful if someone could point me to methods of calculations applicable here.

I have found such method as camera transform using pinhole camera model to represent object in 3d space on 2d plane, but seems that it is not what I am looking for.

## Computation of contour integral without winding numbers.

I am trying to solve problem $$3$$ on page 108 in Ahlfors. The problem asks to compute $$\int_{\left\vert z \right\vert = 2} \frac{dz}{z^2 – 1}$$ so I am trying to do so without the use of winding numbers, which isn’t introduced until later sections.

I first used partial fraction decomposition to write $$\frac{1}{z^2 – 1}$$ as $$\frac{1}{2} \cdot (\frac{1}{z-1} – \frac{1}{z+1})$$. From here, it’s clear that the integral is $$0$$ if we resort to winding numbers. Since I was unable to compute the integral using elementary methods, I resorted to reading this solution. However, I don’t understand how they changed the path of integration from $$\left\vert z \right\vert = 2$$ to $$\left\vert z – 1 \right\vert = 1$$ because when $$z = -2$$, $$\left\vert z – 1 \right\vert = \left\vert -3 \right\vert = 3 \ne 1$$.