Bug 241047 - Problems with Summations
Summary: Problems with Summations
Status: RESOLVED FIXED
Alias: None
Product: kalgebra
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Aleix Pol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-07 22:30 UTC by Adria
Modified: 2010-12-14 05:00 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
KAlgebra script with the summation (260 bytes, text/plain)
2010-06-07 22:30 UTC, Adria
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adria 2010-06-07 22:30:33 UTC
Created attachment 47792 [details]
KAlgebra script with the summation

Version:           unspecified (using KDE 4.4.3) 
OS:                Linux

There are some problems with summations:

 - Sometimes I can't define them (see Steps to reproduce)
 - The results from summations are not correct

Thanks in advance



Reproducible: Always

Steps to Reproduce:
Type this into KAlgebra console:
comb:=(n, i)->factorial(n)/(factorial(i)*factorial(n-i))
p:=10^-2
pu:=n->sum(comb(n,i)*p^(n-i)*(1-p)^i:i=(floor((n-1)/2))..n) -> Can't define

pu:=n->sum(comb(n,i)*p^(n-i)*(1-p)^i:i=0..(floor((n-1)/2))) -> OK

Actual Results:  
If I type:
pu(5)
I get:
25.1510550449

Expected Results:  
The expected result is:
pu5:=comb(5,0)*p^5*(1-p)*0 + comb(5,1)*p^4*(1-p)*1 + comb(5,2)*p^3*(1-p)*3
2.97495e-05

OS: Linux (x86_64) release 2.6.33-ARCH
Compiler: gcc
Comment 1 Aleix Pol 2010-12-14 05:00:35 UTC
SVN commit 1206274 by apol:

Remove some wrong stack depth calculation.
Fixes the following bug, together with the last commit. (at last!)

BUG: 241047


 M  +7 -9      analyzer.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1206274