π
<-
Chat plein-écran
[^]

Generate piecewise function from a BASIC program

Pour le TI-Basic sur Nspire

Generate piecewise function from a BASIC program

Message non lude fredrik.ekelof » 05 Nov 2019, 21:19

Hi

I would need some help on how to automatically generate a piecewise function from within a program written in TI-basic.

Scenario:

I have two list with numbers "xi" and "yi". From those lists I create a new list with several functions. Lets call the list "zi".

Now, I want my program to build up a peicewise function that shall be drawn using the graph app. The length of the piecewise function is not fixed. The number of "pieces can be anywhere between 2 and somewhere around 10.

Basically my problem is. How do I concatenate variables into a piecewise function?

Example of how the final result should work. The length/number of pieces
graph := piecewise(z[n],x[n] <= x <= x[n+1],z[n+1],x[n+1] <= x <= x[n+1].....)
Avatar de l’utilisateur
fredrik.ekelof
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 88%
 
Messages: 10
Inscription: 09 Oct 2019, 13:37
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile

Re: Generate piecewise function from a BASIC program

Message non lude critor » 05 Nov 2019, 21:54

Hm, something like this ?
Image

Code: Tout sélectionner
Define genpw(lx,lz)=
Prgm
:Local s
:s:="f(x):=piecewise("
:For i,1,dim(lz)
:  s:=s&when(i>1,",","")&string(lz[i])&","&string(lx[i])&"≤x≤"&string(lx[i+1])
:EndFor
:s:=s&")"
:expr(s)
:EndPrgm
Image
Avatar de l’utilisateur
critorAdmin
Niveau 19: CU (Créateur Universel)
Niveau 19: CU (Créateur Universel)
Prochain niv.: 42.4%
 
Messages: 41497
Images: 14640
Inscription: 25 Oct 2008, 00:00
Localisation: Montpellier
Genre: Homme
Calculatrice(s):
MyCalcs profile
YouTube: critor3000
Twitter/X: critor2000
GitHub: critor

Re: Generate piecewise function from a BASIC program

Message non lude fredrik.ekelof » 05 Nov 2019, 22:14

Yes, perfect, thanks!
Avatar de l’utilisateur
fredrik.ekelof
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 88%
 
Messages: 10
Inscription: 09 Oct 2019, 13:37
Genre: Non spécifié
Calculatrice(s):
MyCalcs profile


Retourner vers Nspire-Basic

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 12 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1052 utilisateurs:
>1008 invités
>39 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)