modesfreq
DownloadTélécharger
Actions
Vote :
ScreenshotAperçu

Informations
Catégorie :Category: nCreator TI-Nspire
Auteur Author: chapes
Type : Classeur 3.0.1
Page(s) : 1
Taille Size: 1.65 Ko KB
Mis en ligne Uploaded: 13/06/2025 - 22:02:55
Uploadeur Uploader: chapes (Profil)
Téléchargements Downloads: 1
Visibilité Visibility: Archive publique
Shortlink : https://tipla.net/a4720470
Type : Classeur 3.0.1
Page(s) : 1
Taille Size: 1.65 Ko KB
Mis en ligne Uploaded: 13/06/2025 - 22:02:55
Uploadeur Uploader: chapes (Profil)
Téléchargements Downloads: 1
Visibilité Visibility: Archive publique
Shortlink : https://tipla.net/a4720470
Description
Fichier Nspire généré sur TI-Planet.org.
Compatible OS 3.0 et ultérieurs.
<<
Define LibPub getmodes(dataList) = Prgm :Local sortedList, uniqueVals, counts, currentVal, currentCount, maxFreq, modes, i :Local formatted_modes_str, formatted_freq_str :If dim(dataList) = 0 Then :Disp "List is empty." :Return undef :EndIf :sortedList := dataList :SortA sortedList :uniqueVals := {} :counts := {} :currentVal := sortedList[1] :currentCount := 1 :For i, 2, dim(sortedList) :If sortedList[i] = currentVal Then :currentCount +:= 1 :Else : augment(uniqueVals, {currentVal}) : augment(counts, {currentCount}) : currentVal := sortedList[i] : currentCount := 1 :EndIf :EndFor :augment(uniqueVals, {currentVal}) :augment(counts, {currentCount}) :maxFreq := max(counts) :modes := {} :For i, 1, dim(counts) :If counts[i] = maxFreq Then : augment(modes, {uniqueVals[i]}) :EndIf :EndFor :formatted_modes_str := "(" :For i, 1, dim(modes) : formatted_modes_str := formatted_modes_str & string(modes[i]) : If i < dim(modes) Then : formatted_modes_str := formatted_modes_str & ", " : EndIf :EndFor :formatted_modes_str := formatted_modes_str & ")" :formatted_freq_str := "(" & string(maxFreq) & ")" :Disp "The mode(s) is/are: " & formatted_modes_str & " Freq: " & formatted_freq_str :Return modes End Prgm Made with nCreator - tiplanet.org
>>
Compatible OS 3.0 et ultérieurs.
<<
Define LibPub getmodes(dataList) = Prgm :Local sortedList, uniqueVals, counts, currentVal, currentCount, maxFreq, modes, i :Local formatted_modes_str, formatted_freq_str :If dim(dataList) = 0 Then :Disp "List is empty." :Return undef :EndIf :sortedList := dataList :SortA sortedList :uniqueVals := {} :counts := {} :currentVal := sortedList[1] :currentCount := 1 :For i, 2, dim(sortedList) :If sortedList[i] = currentVal Then :currentCount +:= 1 :Else : augment(uniqueVals, {currentVal}) : augment(counts, {currentCount}) : currentVal := sortedList[i] : currentCount := 1 :EndIf :EndFor :augment(uniqueVals, {currentVal}) :augment(counts, {currentCount}) :maxFreq := max(counts) :modes := {} :For i, 1, dim(counts) :If counts[i] = maxFreq Then : augment(modes, {uniqueVals[i]}) :EndIf :EndFor :formatted_modes_str := "(" :For i, 1, dim(modes) : formatted_modes_str := formatted_modes_str & string(modes[i]) : If i < dim(modes) Then : formatted_modes_str := formatted_modes_str & ", " : EndIf :EndFor :formatted_modes_str := formatted_modes_str & ")" :formatted_freq_str := "(" & string(maxFreq) & ")" :Disp "The mode(s) is/are: " & formatted_modes_str & " Freq: " & formatted_freq_str :Return modes End Prgm Made with nCreator - tiplanet.org
>>