Cubic hypersurfaces of complex projective space

Given the equation of a cubic hypersurface $C\subset\mathbb{P}^{N}_{\mathbb{C}}$ ($N\geq 4$), there is an algorithm (or better a software) that allows to determine if $C$ is factorial (i.e., all of whose local rings are unique factorization domains, and hence there is no distinction between Cartier divisors and Weil divisors), and if $\mathrm{Pic}(C)=\mathbb{Z}\langle\mathcal{O}_C(1)\rangle$ ? Of course this is trivial if $C$ is smooth.

Thanks.

-
By the Grothendieck-Lefschetz theorem on Picard groups, the restriction map $Pic(X) \rightarrow Pic(D)$ is an isomorphism when $D$ is an ample effective divisor on $X$ and the dimension of $X$ is at least $4$. So the second part of your question is always the case. See Ample Subvarieties of Alg Var's by Hartshorne (Corollary IV.3.3) and Positivity in Alg. Geom. I Remark (3.1.26.) – Parsa Jun 17 '11 at 12:36
Parsa, this is true when $C$ is smooth. – Francesco Polizzi Jun 17 '11 at 12:39
Why do you need smoothness? In the case $D$ is reduced, you have the Lefschetz hyperplane theorem, and if $D$ is reduced means its exponential sequence is exact, so you use the Kodaira vanishings on $X$ to get the vanishings you need on $D$, and the 5-lemma on the long exact sequence associated to the exponential sequences of $X$ and $D$ gives you the isomorphism $H^1(X,\mathcal {O_X}^*) \cong H^1(D,\mathcal {O_D}^*)$. – Parsa Jun 17 '11 at 13:04
Sorry yiou are right, I misread your comment. Now I understand what you say. Well, usually "factorial" means that every codimension 1 subvariety is cut out by an hypersurface in the ambient space, and my answer shows that it is not always the case. But, as you remark, if C is not smooth this is not equivalent to $\textrm{Pic}(C)=Z$ . – Francesco Polizzi Jun 17 '11 at 13:26

First concerning your question: most people use $\operatorname{Pic}(C)$ for Cartier divisors. I interpret your question as follows: you want to determine whether every divisor on $C$ is linear equivalent with a Cartier divisor (this means factorial).
Now if $C$ is smooth this is true and I think this is also true if $\dim C-\dim C_{sing}>3$.
If $\dim C_{sing}\geq \dim C-3$ things are much more complicated. A necessary condition for being factorial is (roughly said) that the rank of $H^{N-2,N-2}(C,\mathbb{C}) \cap H^{2N-4}(C,\mathbb{Z})$ equals one. (If the MHS on H^{2N-2}$does not have pure weight you have to be a bit more careful here.) If$\Sigma=C_{sing}$then you have an exact sequence $$H^{2N-5}(C)\to H^{2N-5}(C\setminus \Sigma)\to H^{2N-4}_\Sigma(C)\to H^{2N-4}(C).$$ If I remember correctly there should be a copy of$H^2(\Sigma) $inside$H^{2N-4}_{\Sigma} (C)$. If this is all of$H^{2N-4}_\Sigma$then you can relatively easily show that$H^{2N-4}(C)$is one-dimensional and hence each divisor on$C$is homologically equivalent to a Cartier divisor. If$H^{2N-4}_\Sigma(C)$is bigger then$H^2(\Sigma)$things are getting complicated. In the case that$\dim \Sigma=0$, i.e.,$C$has isolated singularities then the only interesting case is$N=4$. Now$H^4_\Sigma$is the part of the cohomology of the Milnor fiber that is invariant under the monodromy. This can be calculated using Singular. In some case you can actually calculate the cokernel$K$of$H^3(C\setminus \Sigma)\to H^4_\Sigma(C)$. For this see e.g., Dimca's paper on Betti numbers and defects of linear systems. It turns out that$K$is the primitive cohomology group$H^4(C,\mathbb{C})$The formula Francesco mentioned is a special case of Dimca's approach. Grooten-Steenbrink and Hulek-K. gave similar formula as Dimca for certain classes of nonisolated singularities. - As Parsa explained in his comment, we always have$\textrm{Pic}(C)=\mathbb{Z}$by Grothendieck.-Lefschetz. However, when$C$is not smooth this does not mean that$C$is factorial, that is that every Weil divisor is Cartier. So we must understand when this happens. I do not know whether there are satisfactory results in every dimension and for any type of singularities. Let me give an answer for$N=4$, under the condition that$C$has only isolated ordinary double points ("nodes"). Then there is the following result: Theorem. Let$C \subset \mathbb{P}^4$be a hypersurface of degree$d$with at most ordinary double points as singularity. Let$\Sigma:=\textrm{Sing}(C)$. Then the following are equivalent: 1. every divisor on the threefold$C$is Cartier; 2. every surface$S \subset C$is cut out on$C$by an hypersurface in$\mathbb{P}^4;$3. the set$\Sigma$imposes independent linear conditions on linear forms of degree$2d-5$. In other words,$C$is factorial if and only if $$H^1(\mathcal{O}_{\mathbb{P}^4}(2d-5) \otimes \mathcal{I}_{\Sigma})=0. \quad (\star)$$ If you have an explicit equation for$C$, you can easily check whether condition$(\star)$holds by using Macauley2. Cheltsov showed that that if$|\Sigma| <(d-1)^2$then$C$is factorial. For instance, a nodal cubic with at most$8$nodes is factorial. This result does not hold if$|\Sigma|=(d-1)^2$: in fact, any hypersurface of the form $$x_0F+x_1G=0,$$ with$F$and$G$general linear forms of degree$d-1$, is not factorial since it contains the$2$-plane$x_o=x_1=0$: notice that there are$(d-1)^2\$ nodes on this plane.