Bug 241047

Summary: Problems with Summations
Product: [Applications] kalgebra Reporter: Adria <swiftscythe>
Component: generalAssignee: Aleix Pol <aleixpol>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: KAlgebra script with the summation

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