# Incorrect answer of FunctionAnalytic

A new command FunctionAnalytic of version 12.2 sometimes produces incorrect results, e.g.

FunctionAnalytic[Cos[Sqrt[z]], z]


False

FunctionAnalytic[Cos[Sqrt[z]], z, Complexes]


FunctionAnalytic[Cos[Sqrt[z]],z,\[DoubleStruckCapitalC]]

Up to Wiki and other sources, this is an entire function of order $$\frac 1 2$$.

Moreover,

FunctionAnalytic[Sum[(-1)^n*z^n/(2*n)!, {n, 0, Infinity}], z]


False

Also

ComplexPlot[Cos[Sqrt[z]], {z, -5 - 5*I, 5 + 5*I}]


shows the superfluous cut along the negatve ray of the real axis. Is there a workaround?

FunctionAnalytic[Product[1 - z^2/n^2, {n, 1, Infinity}], z,Complexes]


False

, whereas

FunctionAnalytic[Product[1 - z^2/Pi^2/n^2, {n, 1, Infinity}], z,Complexes]


True

It's clear that the multplier $$\frac 1 {\pi^2}$$ is not of importance for the analycity.

Addition 2. Another deficiency

FunctionAnalytic[ Piecewise[{{z, Abs[z] <= 1}, {z, Abs[z] > 1}}], z, Complexes]


False

I am sure z is analytic.

• Comments are not for extended discussion; this conversation has been moved to chat.
– Kuba
Commented Dec 19, 2020 at 22:03
• Another incorrect answer is that FunctionAnalytic[{Abs[w]^2*z/Conjugate[w], w != 0}, {z, w}, Complexes] produces False though Abs[w]^2*z/Conjugate[w] // FullSimplify performs w*z. Commented Dec 24, 2020 at 19:22

As noted in the chat discussion, the first example is actually one of the "Possible Issues" documentation examples for FunctionAnalytic. If any subexpression of f is not real-valued at a point, Mathematica considers this point to be outside the real domain of the expression f, even if the whole expression f is real-valued. By this definition, negative z are not in the real domain of Cos[Sqrt[z]], and hence Cos[Sqrt[z]] is not real analytic over the whole reals.

FunctionAnalytic works by collecting information about possible singularities of all subexpressions of f -- these are the solutions of conditions returned by FunctionSingularities. If the solution set of the constraints does not contain any possible singularities, FunctionAnalytic returns True. Otherwise it tries to prove that one of the possible singularities is an actual singularity -- f is undefined or discontinuous at that point, or the series of f at that point contains fractional powers. If FunctionAnalytic finds such a point it returns False. Otherwise FunctionAnalytic is likely going to fail. Its capabilities of proving that all possible singularities are not actual singularities (e.g. branch cuts of subexpressions cancel) are very limited.

ComplexPlot uses possible singularites (i.e. the singularities of all subexpressions) as the default exclusions. You can specify the exclusions using the Exclusions option. In particular, with Exclusions->None, ComplexPlot will not use any exclusions.

As for the last two examples, arguments of FunctionAnalytic are evaluated before FunctionAnalytic sees them, so you need to look at what the products evaluate to.

In[1]:= Product[1 - z^2/n^2, {n, 1, Infinity}]

Sin[Pi z]
Out[1]= ---------
Pi z


This expression is undefined at z == 0, hence not analytic.

In[2]:= % /. z->0 // Quiet

Out[2]= Indeterminate


The second product evaluates to Sinc[z], which is analytic.

In[3]:= Product[1 - z^2/Pi^2/n^2, {n, 1, Infinity}]

Out[3]= Sinc[z]


Of course the first product could evalute to Sinc[Pi z], so there is a possibility for improvement here.

• Sorry, you partially explain a work of FunctionAnalytic command, repeating the comments of @MichaelE2. Agree that the behavior of FunctionAnalytic[Sum[(-1)^n*z^n/(2*n)!, {n, 0, Infinity}], z] is beneath criticism and this is not described in the documentation. Commented Dec 22, 2020 at 17:33