π
<-

[Algorithme] Suites

:32tins: :32tinsktpb: :32tinsktpn: :32tinscas: :32tinstpkc: :32tinstpktpb: :32tinstp: :32tinscastp: :32tinscmc: :32tinscx: :32tinscxcas:

[Algorithme] Suites

Unread postby matmout69 » 02 Oct 2014, 19:47

Bonsoir,

Cela fait plusieurs jours que je cherche un programme de ce genre :
Image

J'aimerais savoir si vous sauriez comment reproduire ce genre sur Ti Nspire CX CAS, merci :)

Cordialement,
User avatar
matmout69
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 0%
 
Posts: 4
Joined: 02 Oct 2014, 19:40
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: [Algorythme] Suites

Unread postby Adriweb » 02 Oct 2014, 19:56

Je ne peux que te conseiller de regarder nos corrections d'exercices d'algorithmique qui font justement ce genre de choses.

Et puis pour apprendre à programmer en Basic sur la Nspire, regarde par ici : https://www.youtube.com/watch?v=MB9HHiW ... KDx8Y8KacD

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
My calculator programs
Mes programmes pour calculatrices
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 79.9%
 
Posts: 14840
Images: 1133
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: [Algorythme] Suites

Unread postby matmout69 » 02 Oct 2014, 20:30

Merci beaucoup ! :)
User avatar
matmout69
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 0%
 
Posts: 4
Joined: 02 Oct 2014, 19:40
Gender: Not specified
Calculator(s):
MyCalcs profile

Re: [Algorithme] Suites

Unread postby Levak » 02 Oct 2014, 22:21

Si ce n'est pas indiscret, le screenshot que tu montres, est-ce un mockup ou est-il issu d'une véritable application (PC/tablette/site internet) ?
Responsable design/graphique de TI-Planet
I do not get mad at people, I just want them to learn the way I learnt.
ImageTNOC [topic][DL]
nClock [topic][DL]
HideManager [topic][DL]
ZLock [topic][DL]
Theme Editor [topic][DL]
Mes programmes
User avatar
LevakAdmin
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 98.9%
 
Posts: 6414
Images: 22
Joined: 27 Nov 2008, 00:00
Location: 0x1AACC355
Gender: Male
Calculator(s):
MyCalcs profile
Class: BAC+5: Epita (ING3)

Re: [Algorithme] Suites

Unread postby Bisam » 02 Oct 2014, 22:23

Il me semble que c'est Algobox... mis je ne peux pas t'en dire plus : je ne l'ai jamais utilisé.
Critor connait certainement, en revanche.
User avatar
BisamAdmin
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Level up: 69.6%
 
Posts: 5670
Joined: 11 Mar 2008, 00:00
Location: Lyon
Gender: Male
Calculator(s):
MyCalcs profile

Re: [Algorithme] Suites

Unread postby Adriweb » 02 Oct 2014, 22:31

Oui, c'est algobox, j'ai meme un prototruc qui convertit du code (a gauche) en Nspire-Basic (a droite) en direct...

Image

Pour le fun :
Show/Hide spoilerAfficher/Masquer le spoiler
Code: Select all
                             
-- Algobox to TI-Nspire Basic converter
-- Adrien "Adriweb" Bertrand
-- v0.2 alpha
-- July 7th, 2014

platform.apilevel = '2.0'

function string:trim()
    return self:gsub("^%s*(.-)%s*$", "%1")
end

function deleteNumbersAtBeginning(str)
    return str:gsub('^%d*(%s*.+)$', function(x) return x end)
end

local __VAL = "%w+%[*%w*%]*" -- regexp for a value.

function replaceThings(str)
    str = str:gsub('^%s*(VARIABLES)%s*$', "")--"© %1")
    str = str:gsub('^(%s*)(%w+) EST_DU_TYPE (.+)%s*$', "%1Local %2")--        © %3")
    str = str:gsub('^%s*(DEBUT_ALGORITHME)%s*$', "")--"© %1")
   
    str = str:gsub('^%s*DEBUT_.*$', '')
   
    str = str:gsub('!=', '≠')
    str = str:gsub('==', '=')
    str = str:gsub('('..__VAL..')%%('..__VAL..')', 'mod(%1, %2)')
    str = str:gsub('random%(%)', 'rand%(%)')

    str = str:gsub('^(%s*)('..__VAL..') PREND_LA_VALEUR (.+)%s*$', "%1%2:=%3")
   
    str = str:gsub('^(%s*)POUR (.-) ALLANT_DE (.-) A (.-)%s*$', "%1For %2,%3,%4")
    str = str:gsub('^(%s*)TANT_QUE (.-) FAIRE%s*$', "%1While %2")
    str = str:gsub('^(%s*)SINON%s*$', "__SINON__")
    str = str:gsub('^(%s*)SI (.-) ALORS%s*$', "%1If %2 Then")
   
    str = str:gsub('^(%s*)AFFICHER (.+)%s*$', "%1Disp %2")
    str = str:gsub('^(%s*)LIRE (%w+)%s*$', "%1Request \"%2= %?\", %2")
    str = str:gsub('^(%s*)(TRACER_.+)%s*$', '') -- "%1© %2") -- to handle later.
   
    str = str:gsub('^(%s*)FIN_POUR', '%1EndFor')
    str = str:gsub('^(%s*)FIN_SINON', '%1EndIf')
    str = str:gsub('^(%s*)FIN_SI', '%1EndIf')
    str = str:gsub('^(%s*)FIN_TANT_QUE', '%1EndWhile')
    str = str:gsub('^%s*(FIN_ALGORITHME)%s*$', "")--"© %1")
   
    -- todo : handle powers like    "1e-8"  => "1−8"  ( <=  there is a charactere between, no space)
   
    return str
end

function secondPass(code)
    code = code:gsub(":(%s*)EndIf\n:__SINON__", "%1 : Else")
    return code
end

code = [[1   VARIABLES
2     x EST_DU_TYPE NOMBRE
3     y EST_DU_TYPE NOMBRE
4     a EST_DU_TYPE NOMBRE
5   DEBUT_ALGORITHME
6     LIRE a
7     x PREND_LA_VALEUR 1
8     y PREND_LA_VALEUR a
9     TANT_QUE (abs(y-x)>1.−8) FAIRE
10      DEBUT_TANT_QUE
11      x PREND_LA_VALEUR (x+y)/2
12      y PREND_LA_VALEUR a/x
13      SI (x<y) ALORS
14        DEBUT_SI
15        AFFICHER approx(x), " < approx(racine) < ", approx(y)
18        FIN_SI
19        SINON
20          DEBUT_SINON
21          AFFICHER approx(y), " < approx(racine) < ", approx(x)
24          FIN_SINON
25      FIN_TANT_QUE
26  FIN_ALGORITHME]]

lineBreak = [[

]]
progLines = ":"

function convert(code)
    newCodeTbl = {}
   
    for line in code:gmatch("[^\r\n]+") do
        --ligneNew = deleteWhiteSpacesAtBeginning(line)
        ligneNew = deleteNumbersAtBeginning(line)
        ligneNew = replaceThings(ligneNew)
        newCodeTbl[#newCodeTbl+1] = ligneNew
    end
       
    progLines = ""
    for i,ligne in ipairs(newCodeTbl) do
        if #ligne > 0 then
            progLines = progLines .. ":" .. ligne .. lineBreak
        end
    end
   
    progLines = secondPass(progLines)
   
    progStr = [[Define algo()=
Prgm
]] .. progLines .. [[
:EndPrgm]]

    destED:setText(progLines)
end


function on.enterKey()
    code = sourceED:getText()
    convert(code)
    _res, _err = math.evalStr("DelVar algo:"..progStr)
    if not _res then
        print("Problem while saving (" .. (_err==910 and "syntax error" or ("errCode: " .. _err)) .. ")" )
    else
        print("Program saved successfully !")
    end
end

function on.construction()
    toolpalette.enableCopy(true)
    toolpalette.enableCut(true)
    toolpalette.enablePaste(true)
    sourceED = D2Editor.newRichText():setBorder(1):setText(code):setReadOnly(false):setBorder(1)
    sourceED:registerFilter({escapeKey = on.enterKey})
    destED = D2Editor.newRichText():setBorder(1):setText(progLines):setReadOnly(true):setBorder(1)
    convert(code)
end

function on.resize(w,h)
   sourceED:move(1,1)
   sourceED:resize(w/2-2,h-30-2)
   destED:move(w/2+1,1)
   destED:resize(w/2-2,h-30-2)
   W,H = w,h
end

function on.paint(gc)
    gc:drawString("Press [enter] to export the program",W/2-105,H-26,"top")
end


function myErrorHandler(line, errMsg, callStack, locals)
    print("Error handled ! ", errMsg)
    return true -- let the script continue
end
platform.registerErrorHandler(myErrorHandler)

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
My calculator programs
Mes programmes pour calculatrices
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 79.9%
 
Posts: 14840
Images: 1133
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb


Return to Problèmes divers / Aide débutants

Who is online

Users browsing this forum: ClaudeBot [spider] and 38 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
1234
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
2898 utilisateurs:
>2864 invités
>27 membres
>7 robots
Record simultané (sur 6 mois):
7582 utilisateurs (le 25/06/2025)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)