My calc is Nspire cx cas
I try to make a complex partial fraction because the calc make only real one using expand
I try to write a function but there is an error that is not clear to me why
I make the same steps in a Document or scratchpad and work good
Here is my code :
- Code: Select all
Define LibPub partialf(expre)=
:Func
:Local ex,r,rc,exc,k,x,kc
:expr("ex(s):="&string(expre))
:r:=polyRoots(getDenom(ex(s)),s)
:exc(s):=ex(s)*s
:rc:=cPolyRoots(getDenom(exc(s)),s)
:k(s):=((getNum(ex(s)))/(2*s*imag(rc[2])*i))
:kc:=k(rc[2])
:Return kc
:EndFunc
This is only the start and i assume that the i have a real root (s = 0) and two conj complex roots s={(-a+b*i),(-a-b*i)}
The error in this line : kc:=k(rc[2])