π
<-

## Complex partial fraction

Pour le TI-Basic sur Nspire

### Complex partial fraction

Hi all
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: Tout sélectionner
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])
Dernière édition par m_elborolossy le 08 Mai 2015, 15:48, édité 2 fois.

m_elborolossy

Niveau 6: SM (Super Membre)
Prochain niv.: 90.6%

Messages: 4
Inscription: 19 Oct 2014, 01:58
Genre:
Calculatrice(s):

### Re: Complex partial fraction

I spotted a possible (and quite usual) problem.

When you create a function by using f(s):= anything, the right member is NOT evaluated.
It will only be evaluated when you will use the function and replace the value of "s" by any expression.

At this time, the calc may see an error such as a "division by zero" that couldn't be seen earlier.
I think that, in your case, exc(s) still has zero as a root of denominator... or something like that.

Did you try to "disp" some intermediate results to spot the problem more precisely ?
And what is the error returned ?

Niveau 15: CC (Chevalier des Calculatrices)
Prochain niv.: 45.8%

Messages: 5397
Inscription: 11 Mar 2008, 00:00
Localisation: Lyon
Genre:
Calculatrice(s):
Classe: Prof de Math en Maths Spé PSI

### Re: Complex partial fraction

Thanks Bisam
I think it works now good
When I finish it i will upload it
This is the updated code :
Code: Tout sélectionner
Define LibPub partialf(expre)=Func:Local ex,r,rc,exc,k,x,kc:expr("ex(s):="&string(expre)):r:=polyRoots(getDenom(ex(s)),s):expr("exc(s):="&string(ex(s)*s)):rc:=cPolyRoots(getDenom(exc(s)),s):expr("k(s):="&string(((getNum(ex(s)))/(2*s*imag(rc[2])*i)))):kc:=k(rc[2]):Return kc:EndFunc
Dernière édition par m_elborolossy le 08 Mai 2015, 15:53, édité 3 fois.

m_elborolossy

Niveau 6: SM (Super Membre)
Prochain niv.: 90.6%

Messages: 4
Inscription: 19 Oct 2014, 01:58
Genre:
Calculatrice(s):

### Re: Complex partial fraction

Nice !
Glad to have helped... and thankful for having talked with someone who knows how to program decently !
Dernière édition par Bisam le 08 Mai 2015, 15:57, édité 1 fois.

Niveau 15: CC (Chevalier des Calculatrices)
Prochain niv.: 45.8%

Messages: 5397
Inscription: 11 Mar 2008, 00:00
Localisation: Lyon
Genre:
Calculatrice(s):
Classe: Prof de Math en Maths Spé PSI

### Re: Complex partial fraction

wonderful !!We hope this program

jmat

Niveau 7: EP (Espèce Protégée: geek)
Prochain niv.: 12.5%

Messages: 50
Inscription: 24 Juil 2013, 01:03
Genre:
Calculatrice(s):

### Re: Complex partial fraction

Uh ?
Seems to be an early posting...

Niveau 15: CC (Chevalier des Calculatrices)
Prochain niv.: 45.8%

Messages: 5397
Inscription: 11 Mar 2008, 00:00
Localisation: Lyon
Genre:
Calculatrice(s):
Classe: Prof de Math en Maths Spé PSI

### Re: Complex partial fraction

Hi there,
Did you ever finish the code for this? If so, is there somewhere I can download it?

I really need something like this on my nspire.

Thanks
Mike

mike martin

Niveau 0: MI (Membre Inactif)
Prochain niv.: 0%

Messages: 1
Inscription: 31 Juil 2016, 14:10
Genre:

### Re: Complex partial fraction

Just try to create it yourself by copying the code which is on the 3rd post.

Niveau 15: CC (Chevalier des Calculatrices)
Prochain niv.: 45.8%

Messages: 5397
Inscription: 11 Mar 2008, 00:00
Localisation: Lyon
Genre:
Calculatrice(s):
Classe: Prof de Math en Maths Spé PSI

### Re: Complex partial fraction

When I use the code in the third post with a function such as:

(0.4)*(s-1500)/(s^2+1000*s+1.25*10^6)

I get too many arguments error. Does the program listed above work for anyone else?

endothes

Niveau 0: MI (Membre Inactif)
Prochain niv.: 0%

Messages: 1
Inscription: 07 Oct 2018, 03:18
Genre:
Calculatrice(s):

### Re: Complex partial fraction

endothes a écrit:When I use the code in the third post with a function such as:

(0.4)*(s-1500)/(s^2+1000*s+1.25*10^6)

I get too many arguments error. Does the program listed above work for anyone else?

http://www.allcalc.tk/10272 (PFE)
http://www.allcalc.tk/4982 (PFE + inverse L-Transformation)

Best,

Hisham

Hisham

Niveau 0: MI (Membre Inactif)
Prochain niv.: 0%

Messages: 15
Inscription: 01 Mar 2017, 20:52
Genre:
Calculatrice(s):

Retourner vers Nspire-Basic

### Qui est en ligne

Utilisateurs parcourant ce forum: Exabot [Bot] et 3 invités

-
Rechercher
-
Sujets à la une
123456
-
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...

Découvrez les avantages d'un compte donateur !

-
Sélections fichiers

Calcul Mental Deluxe (Lua) (217)
(31/05/2014)

TabVar 3 (51425)
(29/10/2011)

LabyRoll (alpha) (521)
(01/01/2012)
1234
Partenaires et pub

-
Stats.
434 utilisateurs:
>373 invités
>56 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Autres sites intéressants
Texas Instruments Education
Global | France
(English / Français)
Banque de programmes TI
ticalc.org
(English)
La communauté TI-82
tout82.free.fr
(Français)