Python 中的正态分布函数

问题描述 投票:0回答:1

如何用Python编写正态分布的乘法函数?

我的代码中有一个错误,如下所示,我想修复此错误。

TypeError:unsupported operand type(s) for *: 'Add' and " NormalDistribution"
python function sympy normal-distribution derivative
1个回答
0
投票

如果你的问题直接=>“如何用Python编写正态分布的乘法函数?”

示例代码:

import numpy as np
from scipy.stats import norm

mu = 0; sigma = 1
sample = np.random.normal(mu, sigma, size=10) # normal distribution series with numpy
result = sample * 2.0  # multiply with constant 2.0

print(result)

输出:

© www.soinside.com 2019 - 2024. All rights reserved.