← Back to team overview

dolfin team mailing list archive

[Question #148576]: Gaussian random numbers

 

New question #148576 on DOLFIN:
https://answers.launchpad.net/dolfin/+question/148576

Hi, 

has the random number generator changed since 0.9.8 ?

in DOLFIN 0.9.8 the instructions following instructions worked fine

from dolfin import *
from random import *

# random funtion
class myrand(Expression):
    def eval(self, values, x):
        values[0] = gauss(0,1)

# Create mesh and finite element
mesh = UnitCircle(60)
V = FunctionSpace(mesh, "CG", 1)

unoise = Function(V)
noise = myrand(V=V)

but in the latest version 0.9.10 we get the error:

Calling FFC just-in-time (JIT) compiler, this may take some time.
Traceback (most recent call last):
  File "noiser.py", line 23, in <module>
    noise = myrand(V=V)
  File "/usr/lib/python2.6/dist-packages/dolfin/function/expression.py", line 146, in __init__
    raise TypeError, "expected only 'kwargs' from one of "\
TypeError: expected only 'kwargs' from one of 'element', or 'degree'

Can you help?

Best, Morton & Achim

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.



Follow ups