Ask Your Question

Revision history [back]

Looking to the documentation:

sage: RealDistribution?

there seems not to be a parameter to fix the center of a Gaussian distribution. But you can do the translation by yourself:

sage: center = 2
sage: variance = 0.75
sage: gaussian = RealDistribution('gaussian', variance)
sage: random_values = [gaussian.get_random_element() + center for i in range(1000)]

Looking to the documentation:

sage: RealDistribution?

there seems not to be a parameter to fix the center of a Gaussian distribution. But you can do the translation by yourself:

sage: center = 2
sage: variance = 0.75
sage: gaussian = RealDistribution('gaussian', variance)
sage: random_values centered_random_values = [gaussian.get_random_element() + center for i in range(1000)]
sage: centered_distribution = lambda x : gaussian.distribution_function(x-center)
sage: plot(centered_distribution,(-5,5))

Looking to the documentation:

sage: RealDistribution?

there seems not to be a parameter to fix the center of a Gaussian distribution. But you can do the translation by yourself:

sage: center = 2
sage: variance = 0.75
sage: gaussian = RealDistribution('gaussian', variance)
sage: centered_random_values = [gaussian.get_random_element() + center for i in range(1000)]
sage: centered_distribution centered_distribution_function = lambda x : gaussian.distribution_function(x-center)
sage: plot(centered_distribution,(-5,5))
plot(centered_distribution_function,(-5,5))