这很可能是因为我不知道如何使用标准的scipy expect函数方法。当我使用时:
np.mean(np.random.uniform(-0.2,0.2,1000)**2)
我有价值:0.0026666666666666666
如果我使用手动计算:
<head runat="server">
<title></title>
</head>
<body style="direction:rtl;width:100%;background-color:#808080">
<form id="frmLevel2" runat="server">
<div dir="ltr" style="width:1000px;">
<asp:Button ID="btnExit" runat="server" OnClick="btnExit_Click" Text="خروج" />
</div>
<div>
<asp:GridView ID="GVLevel2" runat="server" Font-Names="Times New Roman" Font-Size="9pt" Width="700px" AllowPaging="True" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal">
<AlternatingRowStyle BackColor="#F7F7F7" />
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<SortedAscendingCellStyle BackColor="#F4F4FD" />
<SortedAscendingHeaderStyle BackColor="#5A4C9D" />
<SortedDescendingCellStyle BackColor="#D8D8F0" />
<SortedDescendingHeaderStyle BackColor="#3E3277" />
</asp:GridView>
</div>
<div>
<asp:Label ID="erorlabel" runat="server"></asp:Label>
<asp:Label ID="lblresult" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
My Error is " A page can have only one server-side Form tag. " too
i don't have master page
我得到0.013235491320680141,这是我期望的正确值。那么我对标准期望或积分函数做错了什么?请帮忙。
答案 0 :(得分:3)
如果你看the documentation for expect
,ub
和lb
并不代表你的想法。它们是积分的界限,而不是分布的参数。
你真的想要:
scipy.stats.uniform(loc=-0.2, scale=0.4).expect(lambda x: x**2)