---
title: "Rational Solutions"
canonical: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/DifferentialRings/rational-sols.html"
source: "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/DifferentialRings/rational-sols.md"
part: "Commutative Algebra"
chapter: "Differential Rings"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Commutative Algebra", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/index-commutative-algebra.md"}
  - {"title": "Differential Rings", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/DifferentialRings/index-differential-rings.md"}
prev: {"title": "Singular Places and Indicial Polynomials", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/DifferentialRings/singularities.md"}
next: {"title": "Newton Polygons", "source": "https://docs.magma-maths.org/v2.30-1/CommutativeAlgebra/DifferentialRings/newton-polygon.md"}
intrinsics:
  - {"name": "RationalSolutions", "signature": "RationalSolutions(L): RngDiffOpElt -> SeqEnum"}
  - {"name": "HasRationalSolutions", "signature": "HasRationalSolutions(L, g): RngDiffOpElt, RngElt -> BoolElt, RngElt, SeqEnum"}
examples:
  - "ex-a82ef2"
---

# Rational Solutions

<a id="function-rationalsolutions-rngdiffopelt"></a>
## `RationalSolutions(L): RngDiffOpElt -> SeqEnum`

Given a differential operator $L$, a basis of the nullspace of rational solutions of $L(y)=0$ in $F$ is returned as a sequence of basis elements. This function only works for operators whose derivation is defined by a differential. The algorithm that is used is described in Section $4.1$ of [[vdPS03](https://docs.magma-maths.org/v2.30-1/references.md#cite-vdps03)].

<a id="function-hasrationalsolutions-rngdiffopelt-rngelt"></a>
## `HasRationalSolutions(L, g): RngDiffOpElt, RngElt -> BoolElt, RngElt, SeqEnum`

Given a differential operator $L$ with coefficients in $F$ and an element $g$ of $F$, return `true` if there is an element $y\in F$ satisfying $L(y)=g$. If such a solution exists a particular solution in $F$ and the basis of the nullspace of rational solutions in $F$ are also returned. If there is no solution, only `false` is returned. This function only works for operators whose derivation is defined by a differential.

<a id="example-ex-a82ef2"></a>
## `Example: Rational Solutions of an Operator (ex-a82ef2)`

```magma
> F<z> := RationalDifferentialField(Rationals());
> R<D> := DifferentialOperatorRing(F);
> H := (z^2-z)*D^2+(3*z-6)*D+1;
> RationalSolutions(H);
[ (z^4 - 4*z^3 + 6*z^2 - 4*z + 1)/z^5 ]
> L := D^2-6/z^2;
> RationalSolutions(L);
[ z^3, 1/z^2 ]
> Apply(L, z^3+1/z^2);
0
> HasRationalSolutions(L, 6/z);
true -z [ z^3, 1/z^2 ]
> L(-z);
6/z
```
