# substitute(DiffAlgElement,Ring) -- gets the RingElement of a differential form or vector field in a ring

## Synopsis

• Usage:
sub(e,R)
• Function: substitute
• Inputs:
• e, an instance of the type DiffAlgElement, a differential form or vector field
• R, a ring, the target ring
• Outputs:
• , an element of R representing e

## Description

By its nature, the package DiffAlg is constantly changing the rings where its differential forms and vector fields are defined. This function is useful to get information of DiffAlg out to some common polynomial rings and work with the rest of Macaulay2 packages.

In this example we get the singular locus of a logarithmic form and compute its Hilbert polynomial.

 ```i1 : w = random logarithmicForm(2,{1,1},"a",Projective => true) o1 = (35x + 21x )dx + (- 35x + 7x )dx + (- 21x - 7x )dx 1 2 0 0 2 1 0 1 2 o1 : DiffAlgForm``` ```i2 : I = singularIdeal w o2 = ideal (35x + 21x , - 35x + 7x , - 21x - 7x ) 1 2 0 2 0 1 QQ[i] o2 : Ideal of ------[][x , x , x ] 2 0 1 2 i + 1``` ```i3 : S = QQ[gens ring I] o3 = S o3 : PolynomialRing``` ```i4 : hilbertPolynomial (sub(I,S)) o4 = P 0 o4 : ProjectiveHilbertPolynomial```