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].....)
Generate piecewise function from a BASIC program
Voir le premier message non lu • 3 messages
• Page 1 sur 1
-
fredrik.ekelof
Niveau 4: MC (Membre Confirmé)- Messages: 10
- Inscription: 09 Oct 2019, 13:37
- Genre:
- Calculatrice(s):→ MyCalcs profile
Re: Generate piecewise function from a BASIC program
Hm, something like this ?
- 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
-
critorAdmin
Niveau 19: CU (Créateur Universel)- Messages: 41497
- Images: 14640
- Inscription: 25 Oct 2008, 00:00
- Localisation: Montpellier
- Genre:
- Calculatrice(s):→ MyCalcs profile
- YouTube: critor3000
- Twitter/X: critor2000
- GitHub: critor
Re: Generate piecewise function from a BASIC program
Yes, perfect, thanks!
-
fredrik.ekelof
Niveau 4: MC (Membre Confirmé)- Messages: 10
- Inscription: 09 Oct 2019, 13:37
- Genre:
- Calculatrice(s):→ MyCalcs profile
3 messages
• Page 1 sur 1
Qui est en ligne
Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 12 invités