# Tag Info

6

As Brian Borchers pointed out, the question only makes sense up to factors of $2\pi$. I'll assume that you want an answer in $[0, 2\pi)$ then. If there are really big contrasts in the magnitudes $|z_1|, \ldots, |z_n|$ of the numbers you're looking at, you could get some bogus results because of cancellation errors. In that case, it might arguably be better ...

5

I'm afraid the method only works to compute derivatives of real-valued functions (of which you happen to have an implementation that also works on complex values).

5

Note: I'm somewhat worried at this point that the integral values Mathematica gives me are bogus. I thought it was working because it gave a sensible-looking result in a short time, but it might be the case that the method it tries to use is buggy or that I did something wrong. So it might be that the code below isn't working at all, I don't know, sorry. ...

4

Let us parameterize the curve you are looking for by $(x(t),y(t))$ and let us for a moment assume that at all points on this curve $\nabla f(x(t),y(t)) \neq 0$, i.e., the curve never intersects another isocontour line. Then you know that at each point the tangent to the curve $(x(t),y(t))$ is parallel to the isocontour levels of $f$, i.e., that it is ...

4

The approach of using two equations for the real and imaginary parts of an equation is often used. It may lead to more cumbersome formulas, but it is definitely possible and common. An example where this is done in deal.II (a library that I maintain) is here: https://www.dealii.org/developer/doxygen/deal.II/step_29.html

3

The system of equations after discretization with the FEM can be written in real algebra as $$\begin{bmatrix} A_{R} &-A_{I}\\ A_{I} &A_{R} \end{bmatrix} \begin{Bmatrix}p_R\\ p_I\end{Bmatrix} = \begin{Bmatrix}f_R\\ f_I\end{Bmatrix}\, ,$$ where the subindices $R$ and $I$ refer to the real and imaginary parts of the impedance matrix, pressure vector ...

3

While it's especially well-suited for polynomial systems, Smale's $\alpha$-theory gives a way to be certain that the Newton iterates for a nonlinear analytic system will converge, and also gives a criterion for when two distinct initial guesses do or do not converge to the same root. To use it, you'll need both derivatives and bounds on the growth of the ...

2

Because $\mbox{arg}$ wraps around at $2\pi$, the problem is ill-conditioned. You can get a forward error of $2\pi$ (when the sum of the arguments is close to a multiple of $2\pi$) with a backward error that approaches 0. This is true of both of the methods you've proposed.

2

The solutions of the Schroedinger equation are complex-valued, so your inner product needs to be $$(u,v) = \int_\Omega \bar u(x) v(x)\; dx,$$ and the norms then become $$\|u\| = (u,u)^{1/2}.$$ But it is also worth pointing out that you shouldn't think of the Schroedinger equation as a variation of the heat equation that just happens to have an ...

1

As pointed out by @nicoguaro, I did some more tests with a scatterer. The overall set up of these new simulations is the same as in my previous answer, as well as the conclusion. There must be some way of proving mathematically that $A_I = 0$, but unfortunately I don't have the time to investigate it right now. I'll leave an image for further reference.

1

I'd like to share some tests I did in order to see if there's any penalty by not taking the imaginary part into account. Normally, the weak form of the Helmholtz equation is written as $$\int_{\Omega}(\nabla p \cdot \nabla \overline{q} - \kappa ^2 p \overline{q})d \Omega = \int_{\Gamma}g \overline{q}ds$$ But when we account for the real ($p_r$) and imaginary ...

1

Instead of hard coding all cases with a switch clause, you can parametrize the function by its poles: double residue(size_t i, const std::vector<double> &poles) { double res = 1.0; for (size_t j=0; j < poles.size(); j++) { if (j != i) { res *= 1 / (poles[i] - poles[j]); } } return res; } As a side note, I wonder ...

1

It does indeed work to linearize the forward mode this way, and will correspond to machine precision. The reverse or adjoint mode doesn't work this way despite my wishes to the contrary. The derivation I posted doesn't correspond exactly to machine precision, but the numerical tests I did showed that the magnitude of the error depends on the linear tolerance ...

1

To sum the argument works faster and the calculus error is smaller. I think that that is the best way. If we perform the product $Z = z_1 \times z_2 \times ... \times z_n$ the error will be: $$dZ = z_2 z_3 ... z_n dz_1 + z_1 z_3 .... z_n dz_2 + ... + z_1 z_2 ... z_{n-1} dz_n$$ We conclude that: $$dZ \approx Z \, (1/z_1 + 1/z_2 + ... 1/z_n) \, dz$$ ...

1

I think the way to go is to parametrize the integral with a real parameter and integrate the real and imaginary parts seperately. Implementing this is subtle, the implementation depends from case to case.

1

I answered a similar question here. That method works if you have a good way of solving the segment intersection query (easiest if your $f$ returns a signed value so that you can use sign-based bisection). Otherwise, I would try analysis. You can compute the gradient of $f$ with respect to $x$ and $y$ presumably. It's best to carry out the differentiation ...

Only top voted, non community-wiki answers of a minimum length are eligible