# random(DiffAlgElement,Ring) -- replaces the variables of the coefficient ring of a differential form or a vector field with random values

## Synopsis

• Function: random
• Usage:
random(e,R)
• Inputs:
• e, an instance of the type DiffAlgElement, a differential form or vector field with generic coefficients
• R, a ring, the ring where the random values are taken from. Default value is an integer
• Optional inputs:
• Outputs:
• an instance of the type DiffAlgElement, the differential form or vector field e whose variables of the coefficient ring were evaluated at random values

## Description

 i1 : random newForm(2,2,1,"a") o1 = - x dx dx + (- 4x + 3x + x )dx dx + (- 4x + x + 5x )dx dx 1 0 1 0 1 2 0 2 0 1 2 1 2 o1 : DiffAlgForm i2 : random(newField(2,2,"a"),QQ) 22 2 1 5 2 18 28 23 2 43 2 23 o2 = (--x + -x x - --x - --x x + --x x + --x )ax + (- --x - --x x + 63 0 5 0 1 24 1 7 0 2 5 1 2 5 2 0 10 0 3 0 1 ------------------------------------------------------------------------ 1 2 5 9 2 11 2 2 10 59 -x + x x - --x x - --x )ax + (- --x + 4x x - 3x - --x x - --x x 6 1 0 2 12 1 2 10 2 1 18 0 0 1 1 21 0 2 18 1 2 ------------------------------------------------------------------------ 1 2 - -x )ax 4 2 2 o2 : DiffAlgField

Options Density and Height are implemented

 i3 : random(newForm(2,2,1,"a"),Density => .2) o3 = (- 4x - 8x )dx dx + (- 6x + 4x )dx dx 1 2 0 1 0 2 0 2 o3 : DiffAlgForm i4 : random(newForm(2,2,1,"a"),Height => 100) o4 = (58x + 73x - 54x )dx dx + (- 56x + 31x + 48x )dx dx + (32x + 38x 0 1 2 0 1 0 1 2 0 2 0 1 ------------------------------------------------------------------------ - 4x )dx dx 2 1 2 o4 : DiffAlgForm

## Caveat

This routine depends on the Macaulay2 method random which is not implemented in some rings. The option random(...,Density=>...) applied to a non-generic form (such us 2a logarithmic form) may return a form equal to 0