Ti nspire programming - definition of variables











up vote
0
down vote

favorite












I'm trying to make a script in order to perform those two equation with summation:



((−b*σ*yn)/(2))+∑(−σ*(1-((yi)/(yn)))*ab*nbi,i,1,Nf)


and this:



((b*s*yn^(2))/(3))+∑(−σ*(1-((yi)/(yn)))(yi-yn)*ab*nbi,i,1,Nf)


My code is:



Prgm
Local b,h,n,nf,n_tot,mf,ub,lb,hi,ii,msg,y,yn,σ,ab,eq1,eq2

Disp ""
Request "b :",b
Request "h :",h
Request "Ab :",ab
Request "N : ",n
Request "Mf : ",mf
Request "N° tot : ",n_tot
Request "N° over N-A : ",nf

newMat(nf,2)→hi

For ii,1,nf,1
Request "h i-i:",msg
msg→hi[ii,1]
Request "b i-i:",msg
msg→hi[ii,2]
EndFor

Disp "matrix",hi

newMat(1,1)→eq1
newMat(1,1)→eq2

For ii,1,nf,1
((-b*σ*yn)/2) + (−σ*(1-((hi[ii,1])/(yn)))*ab*hi[ii,2])→eq1[ii,1]
((b*s*yn^2)/3) + (−σ*(1-((hi[ii,1])/(yn)))*(hi[ii,1]-
yn)*ab*hi[ii,2])→eq2[ii,1]
EndFor

Disp "eq1:",eq1
Disp "eq2:",eq2
Disp "solution",solve(eq1[1,1]=n and eq2[1,1]=mf+n(0.5*h+yn),{yn,σ})|yn>0

EndPrgm


But i get : "Error: Variable is not defined"



I do not understand why i get this error, what i'm doing wrong?
Any hints will be appreciated,i'm new in programming.










share|improve this question









New contributor




cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    0
    down vote

    favorite












    I'm trying to make a script in order to perform those two equation with summation:



    ((−b*σ*yn)/(2))+∑(−σ*(1-((yi)/(yn)))*ab*nbi,i,1,Nf)


    and this:



    ((b*s*yn^(2))/(3))+∑(−σ*(1-((yi)/(yn)))(yi-yn)*ab*nbi,i,1,Nf)


    My code is:



    Prgm
    Local b,h,n,nf,n_tot,mf,ub,lb,hi,ii,msg,y,yn,σ,ab,eq1,eq2

    Disp ""
    Request "b :",b
    Request "h :",h
    Request "Ab :",ab
    Request "N : ",n
    Request "Mf : ",mf
    Request "N° tot : ",n_tot
    Request "N° over N-A : ",nf

    newMat(nf,2)→hi

    For ii,1,nf,1
    Request "h i-i:",msg
    msg→hi[ii,1]
    Request "b i-i:",msg
    msg→hi[ii,2]
    EndFor

    Disp "matrix",hi

    newMat(1,1)→eq1
    newMat(1,1)→eq2

    For ii,1,nf,1
    ((-b*σ*yn)/2) + (−σ*(1-((hi[ii,1])/(yn)))*ab*hi[ii,2])→eq1[ii,1]
    ((b*s*yn^2)/3) + (−σ*(1-((hi[ii,1])/(yn)))*(hi[ii,1]-
    yn)*ab*hi[ii,2])→eq2[ii,1]
    EndFor

    Disp "eq1:",eq1
    Disp "eq2:",eq2
    Disp "solution",solve(eq1[1,1]=n and eq2[1,1]=mf+n(0.5*h+yn),{yn,σ})|yn>0

    EndPrgm


    But i get : "Error: Variable is not defined"



    I do not understand why i get this error, what i'm doing wrong?
    Any hints will be appreciated,i'm new in programming.










    share|improve this question









    New contributor




    cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm trying to make a script in order to perform those two equation with summation:



      ((−b*σ*yn)/(2))+∑(−σ*(1-((yi)/(yn)))*ab*nbi,i,1,Nf)


      and this:



      ((b*s*yn^(2))/(3))+∑(−σ*(1-((yi)/(yn)))(yi-yn)*ab*nbi,i,1,Nf)


      My code is:



      Prgm
      Local b,h,n,nf,n_tot,mf,ub,lb,hi,ii,msg,y,yn,σ,ab,eq1,eq2

      Disp ""
      Request "b :",b
      Request "h :",h
      Request "Ab :",ab
      Request "N : ",n
      Request "Mf : ",mf
      Request "N° tot : ",n_tot
      Request "N° over N-A : ",nf

      newMat(nf,2)→hi

      For ii,1,nf,1
      Request "h i-i:",msg
      msg→hi[ii,1]
      Request "b i-i:",msg
      msg→hi[ii,2]
      EndFor

      Disp "matrix",hi

      newMat(1,1)→eq1
      newMat(1,1)→eq2

      For ii,1,nf,1
      ((-b*σ*yn)/2) + (−σ*(1-((hi[ii,1])/(yn)))*ab*hi[ii,2])→eq1[ii,1]
      ((b*s*yn^2)/3) + (−σ*(1-((hi[ii,1])/(yn)))*(hi[ii,1]-
      yn)*ab*hi[ii,2])→eq2[ii,1]
      EndFor

      Disp "eq1:",eq1
      Disp "eq2:",eq2
      Disp "solution",solve(eq1[1,1]=n and eq2[1,1]=mf+n(0.5*h+yn),{yn,σ})|yn>0

      EndPrgm


      But i get : "Error: Variable is not defined"



      I do not understand why i get this error, what i'm doing wrong?
      Any hints will be appreciated,i'm new in programming.










      share|improve this question









      New contributor




      cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I'm trying to make a script in order to perform those two equation with summation:



      ((−b*σ*yn)/(2))+∑(−σ*(1-((yi)/(yn)))*ab*nbi,i,1,Nf)


      and this:



      ((b*s*yn^(2))/(3))+∑(−σ*(1-((yi)/(yn)))(yi-yn)*ab*nbi,i,1,Nf)


      My code is:



      Prgm
      Local b,h,n,nf,n_tot,mf,ub,lb,hi,ii,msg,y,yn,σ,ab,eq1,eq2

      Disp ""
      Request "b :",b
      Request "h :",h
      Request "Ab :",ab
      Request "N : ",n
      Request "Mf : ",mf
      Request "N° tot : ",n_tot
      Request "N° over N-A : ",nf

      newMat(nf,2)→hi

      For ii,1,nf,1
      Request "h i-i:",msg
      msg→hi[ii,1]
      Request "b i-i:",msg
      msg→hi[ii,2]
      EndFor

      Disp "matrix",hi

      newMat(1,1)→eq1
      newMat(1,1)→eq2

      For ii,1,nf,1
      ((-b*σ*yn)/2) + (−σ*(1-((hi[ii,1])/(yn)))*ab*hi[ii,2])→eq1[ii,1]
      ((b*s*yn^2)/3) + (−σ*(1-((hi[ii,1])/(yn)))*(hi[ii,1]-
      yn)*ab*hi[ii,2])→eq2[ii,1]
      EndFor

      Disp "eq1:",eq1
      Disp "eq2:",eq2
      Disp "solution",solve(eq1[1,1]=n and eq2[1,1]=mf+n(0.5*h+yn),{yn,σ})|yn>0

      EndPrgm


      But i get : "Error: Variable is not defined"



      I do not understand why i get this error, what i'm doing wrong?
      Any hints will be appreciated,i'm new in programming.







      ti-nspire






      share|improve this question









      New contributor




      cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 2 days ago





















      New contributor




      cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 days ago









      cicciobombacannoniere

      12




      12




      New contributor




      cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Solved: the problem was in Local variable definition.



          Define LibPub bj_semi_rgd_fl()=
          Prgm
          Local b,h,ab,n,mf,nf,hi,msg,i,j
          Request "Larghezza flangia :",b
          Request "Lunghezza flangia :",h
          Request "Sezione bullone :",ab
          Request "N : ",n
          Request "Mf : ",mf
          Request "N° file sopra A-N : ",nf
          hi:=newMat(nf,2)
          For i,1,nf,1
          Request "altezza della fila i-esima:",msg
          hi[i,1]:=msg
          Request "bulloni per fila i-esima:",msg
          hi[i,2]:=msg
          EndFor
          eq1:=0
          eq2:=0
          For j,1,nf,1
          eq1:=eq1+−σ*(1-((hi[j,1])/(yn)))*ab*hi[j,2]
          eq2:=eq2+−σ*(1-((hi[j,1])/(yn)))*(hi[j,1]-yn)*ab*hi[j,2]
          EndFor

          Disp "+++Risultato+++"
          Disp "",solve(((−b*σ*yn)/(2))+eq1=n and ((b*σ*yn^(2))/(3))+eq2=mf+n*(0.5*h+yn),
          {yn,σ})|yn>0
          Disp "++++++++++++"
          DelVar eq1,eq2,yn,σ
          EndPrgm


          So I've just cancelled the variables that are used in the command "solve()". That's all.






          share|improve this answer








          New contributor




          cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.


















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });






            cicciobombacannoniere is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372800%2fti-nspire-programming-definition-of-variables%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            Solved: the problem was in Local variable definition.



            Define LibPub bj_semi_rgd_fl()=
            Prgm
            Local b,h,ab,n,mf,nf,hi,msg,i,j
            Request "Larghezza flangia :",b
            Request "Lunghezza flangia :",h
            Request "Sezione bullone :",ab
            Request "N : ",n
            Request "Mf : ",mf
            Request "N° file sopra A-N : ",nf
            hi:=newMat(nf,2)
            For i,1,nf,1
            Request "altezza della fila i-esima:",msg
            hi[i,1]:=msg
            Request "bulloni per fila i-esima:",msg
            hi[i,2]:=msg
            EndFor
            eq1:=0
            eq2:=0
            For j,1,nf,1
            eq1:=eq1+−σ*(1-((hi[j,1])/(yn)))*ab*hi[j,2]
            eq2:=eq2+−σ*(1-((hi[j,1])/(yn)))*(hi[j,1]-yn)*ab*hi[j,2]
            EndFor

            Disp "+++Risultato+++"
            Disp "",solve(((−b*σ*yn)/(2))+eq1=n and ((b*σ*yn^(2))/(3))+eq2=mf+n*(0.5*h+yn),
            {yn,σ})|yn>0
            Disp "++++++++++++"
            DelVar eq1,eq2,yn,σ
            EndPrgm


            So I've just cancelled the variables that are used in the command "solve()". That's all.






            share|improve this answer








            New contributor




            cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.






















              up vote
              0
              down vote













              Solved: the problem was in Local variable definition.



              Define LibPub bj_semi_rgd_fl()=
              Prgm
              Local b,h,ab,n,mf,nf,hi,msg,i,j
              Request "Larghezza flangia :",b
              Request "Lunghezza flangia :",h
              Request "Sezione bullone :",ab
              Request "N : ",n
              Request "Mf : ",mf
              Request "N° file sopra A-N : ",nf
              hi:=newMat(nf,2)
              For i,1,nf,1
              Request "altezza della fila i-esima:",msg
              hi[i,1]:=msg
              Request "bulloni per fila i-esima:",msg
              hi[i,2]:=msg
              EndFor
              eq1:=0
              eq2:=0
              For j,1,nf,1
              eq1:=eq1+−σ*(1-((hi[j,1])/(yn)))*ab*hi[j,2]
              eq2:=eq2+−σ*(1-((hi[j,1])/(yn)))*(hi[j,1]-yn)*ab*hi[j,2]
              EndFor

              Disp "+++Risultato+++"
              Disp "",solve(((−b*σ*yn)/(2))+eq1=n and ((b*σ*yn^(2))/(3))+eq2=mf+n*(0.5*h+yn),
              {yn,σ})|yn>0
              Disp "++++++++++++"
              DelVar eq1,eq2,yn,σ
              EndPrgm


              So I've just cancelled the variables that are used in the command "solve()". That's all.






              share|improve this answer








              New contributor




              cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.




















                up vote
                0
                down vote










                up vote
                0
                down vote









                Solved: the problem was in Local variable definition.



                Define LibPub bj_semi_rgd_fl()=
                Prgm
                Local b,h,ab,n,mf,nf,hi,msg,i,j
                Request "Larghezza flangia :",b
                Request "Lunghezza flangia :",h
                Request "Sezione bullone :",ab
                Request "N : ",n
                Request "Mf : ",mf
                Request "N° file sopra A-N : ",nf
                hi:=newMat(nf,2)
                For i,1,nf,1
                Request "altezza della fila i-esima:",msg
                hi[i,1]:=msg
                Request "bulloni per fila i-esima:",msg
                hi[i,2]:=msg
                EndFor
                eq1:=0
                eq2:=0
                For j,1,nf,1
                eq1:=eq1+−σ*(1-((hi[j,1])/(yn)))*ab*hi[j,2]
                eq2:=eq2+−σ*(1-((hi[j,1])/(yn)))*(hi[j,1]-yn)*ab*hi[j,2]
                EndFor

                Disp "+++Risultato+++"
                Disp "",solve(((−b*σ*yn)/(2))+eq1=n and ((b*σ*yn^(2))/(3))+eq2=mf+n*(0.5*h+yn),
                {yn,σ})|yn>0
                Disp "++++++++++++"
                DelVar eq1,eq2,yn,σ
                EndPrgm


                So I've just cancelled the variables that are used in the command "solve()". That's all.






                share|improve this answer








                New contributor




                cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                Solved: the problem was in Local variable definition.



                Define LibPub bj_semi_rgd_fl()=
                Prgm
                Local b,h,ab,n,mf,nf,hi,msg,i,j
                Request "Larghezza flangia :",b
                Request "Lunghezza flangia :",h
                Request "Sezione bullone :",ab
                Request "N : ",n
                Request "Mf : ",mf
                Request "N° file sopra A-N : ",nf
                hi:=newMat(nf,2)
                For i,1,nf,1
                Request "altezza della fila i-esima:",msg
                hi[i,1]:=msg
                Request "bulloni per fila i-esima:",msg
                hi[i,2]:=msg
                EndFor
                eq1:=0
                eq2:=0
                For j,1,nf,1
                eq1:=eq1+−σ*(1-((hi[j,1])/(yn)))*ab*hi[j,2]
                eq2:=eq2+−σ*(1-((hi[j,1])/(yn)))*(hi[j,1]-yn)*ab*hi[j,2]
                EndFor

                Disp "+++Risultato+++"
                Disp "",solve(((−b*σ*yn)/(2))+eq1=n and ((b*σ*yn^(2))/(3))+eq2=mf+n*(0.5*h+yn),
                {yn,σ})|yn>0
                Disp "++++++++++++"
                DelVar eq1,eq2,yn,σ
                EndPrgm


                So I've just cancelled the variables that are used in the command "solve()". That's all.







                share|improve this answer








                New contributor




                cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                share|improve this answer



                share|improve this answer






                New contributor




                cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered yesterday









                cicciobombacannoniere

                12




                12




                New contributor




                cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                cicciobombacannoniere is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






















                    cicciobombacannoniere is a new contributor. Be nice, and check out our Code of Conduct.










                     

                    draft saved


                    draft discarded


















                    cicciobombacannoniere is a new contributor. Be nice, and check out our Code of Conduct.













                    cicciobombacannoniere is a new contributor. Be nice, and check out our Code of Conduct.












                    cicciobombacannoniere is a new contributor. Be nice, and check out our Code of Conduct.















                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372800%2fti-nspire-programming-definition-of-variables%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Wiesbaden

                    Marschland

                    Dieringhausen