$\require{AMScd}$
$\require{AMStex}$
$\newcommand{\CC}{{\mathbb C}}$
$\newcommand{\PSP}{\mathbf{\mathbb P}}$
$\newcommand{\AFF}{\mathbf{\mathbb A}}$

$\newcommand{\Ohol}{{\mathcal O}}$
$\newcommand{\Hdr}{H_{\text{DR}}}$
$\newcommand{\HH}{{\mathbb H}}$
$\newcommand{\cover}[1]{{\mathfrak #1}}$
$\newcommand{\Cc}{\check{C}}$
$\newcommand{\codim}{\text{codim}}$

The following remarks outline a strategy for computing $\Hdr^q(X)$ for every quasiprojective variety $X \subseteq \PSP^n_\CC$. I call it a strategy rather than an algorithm, as I think some parts of the calculation still need a lot of thought, to be implemented as an algorithm, especially where spectral sequences appear:

Let $X/k$ be an algebraic variety over $k = \CC$. Consider the sequence
$(\Omega^\bullet_{X|k})$

$$
\Ohol_X = \Omega^0_{X|k} \xrightarrow{d^0} \Omega^1_{X|k} \xrightarrow{d^1} \Omega^2_{X|k}
\xrightarrow{d^2} \cdots
$$

where $\Omega^p_{X|k} = \bigwedge^p \Omega_{X|k}$ and $d^p:\Omega^p_{X|k} \to \Omega^{p+1}_{X|k}$
stands for the exterior derivative. It is $k$--linear but not $\Ohol_X$--linear.

One defines the $i$--th de Rham cohomology of $X$ as

$$
\Hdr^i(X) = \HH^i(\Omega^\bullet_{X|k})
$$

where $\HH^i(L^\bullet)$ is the $i$--th hypercohomology of the complex $L^\bullet$.

If $X$ is an affine variety, it is

$$
\HH^i(\Omega^\bullet_{X|k}) = h^i(\Omega^\bullet_{X|k}(X))
$$

where $h^i(L^\bullet)$ is the usual $i$--th cohomology of $L^\bullet$.
This holds, because $H^j(X, \Omega^p_{X|k}) = 0$ for $j > 0$ as $\Omega^p_{X|k}$ is a quasicoherent
sheaf on an affine scheme.

**Theorem**
Let $U = X - Y$ with $X = \AFF^n_k$ and $Y = V(f_1,\ldots,f_r)$, a closed
subscheme of $X$. It is then possible to compute
$\Hdr^i(U)$ constructively.

This is done with $D$--modules, as described in

Algorithmic Computation of de Rham Cohomology of Complements of Complex Affine Varieties,
*U. Walther*, J. Symb. Comput. 29, No. 4--5, 795--839

From

On the De Rham cohomology of algebraic varieties,
*R. Hartshorne*, Publ. Math., Inst. Hautes Étud. Sci. 45, 5--99

we take, in the situation of the Theorem and with the additional assumption of $Y$ being smooth,
the sequence

$$
\cdots H_q(Y) \to H_q(X) \to H_q(X - Y) \to H_{q-1}(Y) \to H_{q-1}(X) \to \cdots
$$

where $H_q(W)$ stands for the *de Rham homology* introduced there, and the relations
(Proposition 3.4)

\begin{align*}
H_q(X) & = \Hdr^{2n - q}(X) \\
H_q(Y) & = \Hdr^{2r - q}(Y)
\end{align*}
with $\dim X = n$ and $\dim Y = r$ hold.

Together this gives
$$
\cdots \to \Hdr^{2 r - q}(Y) \to \Hdr^{2 n - q}(X) \to \Hdr^{2 n - q}(U) \to
\Hdr^{2r - q + 1}(Y) \to \Hdr^{2 n - q + 1}(X) \to \cdots
$$

or with $s = \codim(Y, X) = n-r$:

$$
\cdots \to \Hdr^{q - 2 s}(Y) \to \Hdr^q(X) \to \Hdr^q(U) \to \Hdr^{q + 1 - 2 s}(Y) \to
\Hdr^{q+1}(X) \to \cdots
$$

But now it is $\Hdr^q(X) = \Hdr^q(\AFF^n_k) = 0$ for $q > 0$, therefore

$$
\Hdr^i(Y) = \Hdr^{i + 2 s - 1}(U)
$$

Because $\Hdr^q(U)$ by the Theorem above can be computed for all $q$, this also holds true for all
$\Hdr^i(Y)$.

It is now time to discuss the case of a general quasiprojective $X \subseteq \PSP^n_k$.
We first assume, that $X$ is *smooth*.

We can write

$$
X = \bar{X} \cap (\PSP^n_k - Z) = \bar{X} \cap U
$$

with closed schemes $\bar{X}, Z \subseteq \PSP^n_k$ and $Z = V(g_1,\ldots,g_s)$
where $g_i$ are homogeneous polynomials in the coordinate ring of $\PSP^n_k$.

Taking the open sets

$$
U_i = D_+(g_i) \subseteq \PSP^n_k
$$

the schemes $V_i = U_i \cap X$ are an open cover of $X$ with affine schemes, in $X$ open.

It is even $V_{i_0 \cdots i_q} = U_{i_0 \cdots i_q} \cap X \subseteq U_{i_0 \cdots i_q}$
a closed, smooth, affine subscheme of the affine scheme

$$
U_{i_0 \cdots i_q} = U_{i_0} \cap \cdots \cap U_{i_q} = D_+(g_{i_0} \cdot \cdots \cdot g_{i_q}).
$$

With a Veronese--embedding $v_d: \PSP^n_k \to \PSP^N_k$ where
$d = \prod_{\nu = 0}^q \deg g_{i_\nu}$, the map

$$
v_d:v_d^{-1}(D_+(w)) = U_{i_0 \cdots i_q} \to D_+(w) = \AFF^N_k
$$

is a closed immersion.
In the above $w$ is a linear form in the coordinate ring of $\PSP^N_k$
derived from $\prod_{\nu=1}^q g_{i_\nu}$.

As $i: V_{i_0 \cdots i_q} \to U_{i_0 \cdots i_q}$ is a closed immersion,
the map

$$
v'_d = v_d \circ i:V_{i_0 \cdots i_q} \to U_{i_0 \cdots i_q} \xrightarrow{v_d} D_+(w) = \AFF^N_k
$$

is a closed immersion too.

So $V_{i_0 \cdots i_q} \cong v'_d(V_{i_0 \cdots i_q})$
is even a closed, smooth subscheme of $\AFF^N_k$.

By the considerations further above $\Hdr^p(V_{i_0\cdots i_q})$ is explicitly computable.

Consider now the Čech-de Rham spectral sequence of the cover $\cover{V} = (V_i)_{i\in I}$
of $X$:

$$
E^{pq}_0 = \Cc^q(\cover{V},\Omega_{X|k}^p) =
\prod_{i_0 < \cdots < i_q} \Gamma(V_{i_0,\ldots,i_q}, \Omega_{X|k}^p)
$$

By general theorem $E^{pq}_r$ abuts against the $\Hdr^\bullet(X)$:

$$
E^{pq}_r \Rightarrow \Hdr^\bullet(X)
$$

See for this

On the de Rham cohomology of algebraic varieties, *M. Stevenson*

section 4.1, p. 7.

If one forms $E^{pq}_1$ taking cohomology along the $p$--axis, the result is

$$
E^{pq}_1 = \prod_{i_0 < \cdots < i_q} \Hdr^p(V_{i_0, \ldots, i_q})
$$

Keep in mind for this that because $V_{i_0,\ldots,i_q}$ is affine, the equality

$$
\Hdr^p(V_{i_0,\ldots,i_q}) = \HH^p(\Omega^\bullet_{V_{i_0,\ldots,i_q}|k}) =
h^p(\Gamma(V_{i_0,\ldots,i_q}, \Omega^\bullet_{V_{i_0,\ldots,i_q}|k}))
$$

holds.

As remarked above $\Hdr^p(V_{i_0,\ldots,i_q})$ is explicitly computable and, at least
theoretically, the abutment $\Hdr^\bullet(X)$ of the spectral sequences allows to be
effectively computed.

**Remark**
The advantage of computing with $E^{pq}_1 = \prod_{i_0 < \cdots < i_q} \Hdr^p(V_{i_0,\ldots,i_q})$
instead of starting with $E^{pq}_0$ directly, is, that the elements of
$E^{pq}_0$ are infinite, but the $E^{pq}_1$ are finite $k$--modules.

The following Theorem is from Hartshorne's articles cited above (Theorem 4.4):

**Theorem**
Let $f:X' \to X$ be a proper map of schemes, $Y \subseteq X$ a subscheme of
$X$, and $Y' = f^{-1}(Y)$ the preimage-scheme of $Y$.

It shall hold

The morphism $f$ maps $X' - Y'$ isomorphically to $X - Y$.

Furthermore there are closed immersions $X' \to Z'$ and $X \to Z$ into smooth schemes
$Z'$, $Z$, together with a proper morphism $g:Z' \to Z$ with
$$
\begin{CD}
X' @>>> Z' \\
@VfVV @VgVV \\
X @>>> Z
\end{CD}
$$
so that $Z' - g^{-1}(Y)$ is mapped isomorphically to $Z - Y$.

Then there is a long exact sequence in de Rham--cohomology

\begin{equation}
\cdots \to \Hdr^q(X) \to \Hdr^q(X') \oplus \Hdr^q(Y) \to \Hdr^q(Y') \to
\Hdr^{q+1}(X) \to \cdots
\end{equation}
(end of theorem)

We can use this theorem, to compute for an arbitrary quasi-projective scheme $X \subseteq \PSP^n_k = Z$
the cohomologies $\Hdr^q(X)$.

We write $X = X_0 \cap U$ with a closed $X_0 \subseteq \PSP^n_k$ and an
open $U \subseteq \PSP^n_k$.

We find for $X_0$ a desingularization $f:X_0' \to X_0$ together with a proper
morphism $g:Z' \to Z$ with

$$
\begin{CD}
X_0' @>>> Z' \\
@VfVV @VgVV \\
X_0 @>>> Z
\end{CD}
$$

where the horizontal maps are closed immersions and $X_0'$ and $Z'$ are smooth schemes.
(See the remark after the theorem cited above in Hartshorne's article). The map
$g$ is the iterative blow-up in nonsingular subschemes.

The morphism $f:X_0' \to X_0$ fulfills the conditions of the above theorem with $X = X_0$,
$X' = X_0'$ and $Y = Y_0 \subseteq X_0$, suitable subscheme with $\dim Y_0 < \dim X_0$,
and $Y' = Y_0' = f^{-1}(Y_0)$. One can choose $Y_0$ to be the subscheme of singular points of $X_0$,
("strong desingularization").

Forming the base-extension of $g$ with $U \to Z$ and those of $f$ with $U \cap X_0 \to X_0$,
we have a compatible system

\begin{equation*}
\begin{CD}
X' = f^{-1}(U \cap X_0) @>>> g^{-1}(U) \\
@Vf'VV @VgVV \\
X @>>> U
\end{CD}
\end{equation*}

so that the morphism $f':f^{-1}(U \cap X_0) \to X$ fulfills the conditions of the theorem above with

\begin{align}
X = X, && X' = f^{-1}(U \cap X_0), && Y = Y_0 \cap U, && Y' = f'^{-1}(Y_0 \cap U).
\end{align}

But $X'$ as an open part of $X_0'$ is a smooth quasi--projective scheme,
so that $\Hdr^q(X')$ is computable. Also $\Hdr^q(Y)$ and $\Hdr^q(Y')$ are computable by induction over
the dimension of the variety, for which cohomology is to be computed.

The long exact sequence from the theorem above gives therefore conditions, from which
$\Hdr^q(X)$ can be computed:

\begin{multline}
\Hdr^{q}(X') \oplus \Hdr^q(Y) \to \Hdr^q(Y') \to \Hdr^{q+1}(X) \to \\
\to \Hdr^{q+1}(X') \oplus \Hdr^{q+1}(Y) \to \Hdr^{q+1}(Y')
\end{multline}

So we can compute $\Hdr^q(X)$ for all quasiprojective
$X \subseteq \PSP^n_k$.

freeof rank 1 over $\mathbb C[T]$, a very satisfying and definitive result. I think that it would be more polite to abstain from writing that a question "does not make sense" just because you have nothing to contribute. $\endgroup$ – Georges Elencwajg Sep 29 at 15:35