ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 10 Oct 2021 16:50:45 +0200Gaussain distributionhttps://ask.sagemath.org/question/59317/gaussain-distribution/ One of the fundamental statistical distribution functions is the Gaussian density function
f(x)=(1/√(2π)) e^(x^2/2)
(a) Use a computer program (i.e. Mathematica) to evaluate the definite integral
integral f(x)dx, from -n to n
for n = 1, 2, 3. Can you exploit a symmetry property of the function f to simplify such evaluations?
(b) Give a convincing argument that
Integral f(x)dx = 1, from negative infinity to infinity
Hint:Show that 0< f(x)<e^(x^2/2) forx>1 and for b>1
Lim (Integral e^(-x^2/2)dx = 0, from b to infinity) as b -> infinityJCMSun, 10 Oct 2021 16:50:45 +0200https://ask.sagemath.org/question/59317/Are q-additive functions implemented in Sage ? Where ?https://ask.sagemath.org/question/42457/are-q-additive-functions-implemented-in-sage-where/ Hi,
We are interested in q-additive functions and sequences. This objects are for instance described in "Sur certaines suites uniformement equireparties modulo 1" (Jean Coquet).
We couldn't find these objects implemented in sage (but maybe we did not look well enough).
Could you please tell us whether q-additive functions are implemented in sage or not ?
Also, if we do implement something about q-additive functions, in which part of sage would it fit the best.
lbTue, 29 May 2018 12:34:09 +0200https://ask.sagemath.org/question/42457/Distribution of a list of numbershttps://ask.sagemath.org/question/8695/distribution-of-a-list-of-numbers/ Hello!
I'd like to know if there is a Sage function to retrieve a distribution of some experimental data.
I have a 1D list of measured values and I need to obtain a second list containing the distribution of that data, for example, to fit it with some Gaussian or Poisson curve.
Thanks.v_2eFri, 03 Feb 2012 13:03:20 +0100https://ask.sagemath.org/question/8695/how to get a log distribution on the x-axis of a semilogx plot?https://ask.sagemath.org/question/24310/how-to-get-a-log-distribution-on-the-x-axis-of-a-semilogx-plot/I tried to plot some frequency response. In the most simple case this may look like A(w). I can make plots using different statements like plot_semiogx, or plot(...,scale='semilogx') etc, but the results look odd. Apparently the internally generated points on the x-axis lways have a linear distribution. Only forcing an exaggerated number of points (e.g. plot_points=100000) results in a correct graph. I didn't find a better solution. I think the plot command should distribute the x-points in a log-fashion automatically for semilogx and loglog plots, thus I consider this a bug. I'm using sage 6.2 right now. Any ideas how to workaround/fix this?
w = var('w')
A0=1e7
w0=100
A(w)=A0*(1/(1+i*w/w0))
plot_semilogx(abs(A(w)),1,1e7)gg@gSat, 27 Sep 2014 15:32:32 +0200https://ask.sagemath.org/question/24310/Seed - probability distribution functionshttps://ask.sagemath.org/question/10194/seed-probability-distribution-functions/Hello experts!
In a new user of sage.
This is a triple-question for you:
1) Reading the 'Craig Finch Sage Beginners Guide' page 236 I find the next script (about accessing probability distribution functions):
variance = 0.75
gaussian = RealDistribution('gaussian', variance)
gaussian.set_seed(0.0)
random_values = [gaussian.get_random_element() for i in range(1000)]
gaussian_plot = gaussian.plot((-5, 5))
The 1st question is ¿Whats for gaussian.set_seed(0.0)? ¿What does (0.0) seed value minds?
2) ¿What must i write in a script for obtain a normal (gaussian) distribution center in 'C' with variance 'V'?
3) Again, in 'Craig Finch Sage Beginners Guide' page 305 i find:
rng = RealDistribution('uniform', [0,dimension], seed=1)
¿Whats for seed=1 value? ¿What does 1 seed value minds?
Waiting for your answers.
Thaks a lot!!mresimulatorWed, 05 Jun 2013 18:38:47 +0200https://ask.sagemath.org/question/10194/Comparaisons between different linux distributionshttps://ask.sagemath.org/question/10190/comparaisons-between-different-linux-distributions/Have you tested and compared the execution speed of different algorithms on different linux distributions?
Are there a faster linux distributions?
And moroplogoTue, 04 Jun 2013 13:58:16 +0200https://ask.sagemath.org/question/10190/integers following Normal distributionhttps://ask.sagemath.org/question/9646/integers-following-normal-distribution/Hello,
how can I produce positive integers, say in (1,n), which follow the normal distribution
with parameters (m,sigma).
Thanks.HelenFri, 21 Dec 2012 07:55:36 +0100https://ask.sagemath.org/question/9646/Best way to handle probability distributionshttps://ask.sagemath.org/question/9480/best-way-to-handle-probability-distributions/I'm curious to know what people recommend as the best way to handle probability distributions in Sage. Using scipy requires setting up a lambda function when doing a plot, and RealDistribution only accepts one parameter (standard deviation) for the normal distribution when there should be two. Is there a better option?calc314Sun, 28 Oct 2012 23:15:51 +0100https://ask.sagemath.org/question/9480/How do I generate a random number according to the binomial distribution?https://ask.sagemath.org/question/8848/how-do-i-generate-a-random-number-according-to-the-binomial-distribution/I would like to generate a random integer according to the binomial distribution. That is, I would like to generate a Bin(n,p) random value. That's number between 0 and n in which the probability we get the value k is `C(n,k)p^k(1-p)^(n-k)`.
Here is an inefficient method (which requires n calls to `random()` ):
def bin_rv(n,p=0.5):
"""
Generate a binomial random variable with parameters n,p.
"""
return sum( random() < p for _ in range(n))
Is there a better way to do this (already built into Sage, I hope)?
(In Matlab, this can be done via the `binord` function and in R with the `rbinom` function.)Ed ScheinermanMon, 02 Apr 2012 15:50:18 +0200https://ask.sagemath.org/question/8848/Gauss distribution fithttps://ask.sagemath.org/question/8721/gauss-distribution-fit/Hello!
I have a problem with fitting my data set with a Gauss (Normal) distribution.
data = [[90.00, 2.0], [97.40, 5.0], [104.8, 14.0], [112.2, 12.0], [119.6, 11.0], \
[127.0, 6.0], [134.4, 3.0], [141.8, 1.0], [149.2, 2.0], [156.6, 1.0]]
var('sigma mu max x')
model(x) = max*(1/sqrt(2*pi*sigma**2))*exp(-(x-mu)**2/(2*sigma**2))
find_fit(data, model)
gives a result:
[sigma == 1.0, mu == 1.0, max == 1.0]
I tried to use a Python function instead of the symbolic one:
var('sigma mu max x')
def model(x,sigma,mu,max):
return max*(1/(sigma*sqrt(2*pi)))*exp(-(x-mu)**2/(2*sigma**2))
find_fit(data, model, parameters=[sigma, mu, max], variables = [x])
and obtained the very same result:
[sigma == 1.0, mu == 1.0, max == 1.0]
Why does it give me this (obviously, incorrect) result? And what is a way to do it right?
Thanks.v_2eSun, 19 Feb 2012 06:19:04 +0100https://ask.sagemath.org/question/8721/