33 Replies Latest reply: Oct 29, 2010 6:16 PM by A.Non RSS

    Finding and Marking.

    lvl107 Gold

        Hi,
      I have a similar question and need help. ( WORKING ON  .MCD12 )

      A.PNGMark6DecNum( ).PNG

      Finding the 6-decimal numbers and marking. (like as above)
      Thanks in advance.
         Regards, -LL-

        • Re: Finding and Marking.
          StuartBruff Platinum

          The attached gives one possibility.   Create a vector whose elements are 1 if the corresponding elements in the target vector match a given criteria (eg, have more than 3 decimal places).   Then use that list to mark up the corresponding elements in the target vector.

           

          Stuart

           

          I don't know if it will work in M12, but it works in M11 and M15.

            • Re: Finding and Marking.
              MikeArmstrong Diamond

              Nice explanation Stuart.

               

              Lovely use of the mod function.

               

              Mike

                • Re: Finding and Marking.
                  StuartBruff Platinum

                  Thanks, Mike.

                   

                   

                  As I hint at in the text, it needs a bit of care in the numerical round-off region, but the numbers given are relatively easy to deal with.  Perhaps somebody might like to suggest a better selection function?

                   

                  Stuart

                    • Re: Finding and Marking.
                      A.Non PTC Community Champion

                      This marks a specific number of decimal places. It's a bit of a mixed up approach, but I  think it should be reliable. It would be less mixed up if I also used string functions to find the number of digits before the decimal point, but the ceil(log) approach was the first thing I thought of and I'm too lazy to change it

                        • Re: Finding and Marking.
                          MikeArmstrong Diamond

                          Nicely done.

                           

                          Have a look below, should your function be:-

                           

                          sss.jpg

                          Mike

                          • Re: Finding and Marking.
                            StuartBruff Platinum

                            Richard Jackson wrote:

                             

                            This marks a specific number of decimal places. It's a bit of a mixed up approach, but I  think it should be reliable. It would be less mixed up if I also used string functions to find the number of digits before the decimal point, but the ceil(log) approach was the first thing I thought of and I'm too lazy to change it

                             

                            Do you mean something like the attached, using search?

                             

                            Stuart

                            • Re: Finding and Marking.
                              lvl107 Gold

                              Richard, it seems that I understand your idea on above, so I would update my question as similar one.

                              A.PNGMark6DecIndex( ).PNG

                              ( Finding the 6-decimal numbers, and Replace them by their Row-index and Marking )
                                Regard, -LL-

                                • Re: Finding and Marking.
                                  StuartBruff Platinum

                                  Loi Le wrote:

                                   

                                  Richard, it seems that I understand your idea on above, so I would update my question as similar one.

                                  A.PNGMark6DecIndex( ).PNG

                                  ( Finding the 6-decimal numbers, and Replace them by their Row-index and Marking )
                                    Regard, -LL-

                                   

                                  Couple of ways to get started.

                                   

                                  1.   If you use a version of a function that iterates through the vector and uses an expression involving the index, then simply replace the 'value' with the index.

                                   

                                  2.   Use a simple 'filter' functions that iterates through the 'normal' result and replaces each nested array (marked element) with its index.

                                   

                                  Stuart

                                    • Re: Finding and Marking.
                                      MikeArmstrong Diamond

                                      Slight alternative attached.

                                       

                                      I have combined into one program so the function is only dependant on one pre-defined function.

                                       

                                      Mike

                                        • Re: Finding and Marking.
                                          StuartBruff Platinum

                                          Mike Armstrong wrote:

                                           

                                          Slight alternative attached.

                                           

                                          I have combined into one program so the function is only dependant on one pre-defined function.

                                           

                                          Mike

                                           

                                           

                                          Oh.  I see.  If somebody else suggests a new method then you can't keep up, but if Micheal suggests one ...   (exit.  stage right. flounce.) 

                                           

                                          I like the use of match, but it is possible to make slightly more efficient use of the results.   OOIC, why did you add one to the index?

                                           

                                          Stuart

                                            • Re: Finding and Marking.
                                              MikeArmstrong Diamond

                                              Ok. I give up you win..... I like this game though.

                                               

                                              I added 1 to the results just to match the original request - Just having one of those moments, sorry!!!!!!

                                               

                                              Mike 

                                                • Re: Finding and Marking.
                                                  StuartBruff Platinum

                                                  Mike Armstrong wrote:

                                                   

                                                  Ok. I give up you win..... I like this game though.

                                                   

                                                  WIWAC, I only got angry with people once; I was lead on a 4 hr exercise (tracking some evaders).  10 minutes before endex, I reckoned the 'enemy' had passed through the area I was staking out and got the team to load up on the 4-tonner to head for the next point I thought the enemy would head for.   The team got on the lorry, then just sat down looking inwards.   Sudden transformation on my part from Mister Quiet to Raging Fury - get off your backsides and get looking .   Got the enemy 2 minutes later!

                                                   

                                                  So the moral of the story is "Don't give up.  It ain't over 'till the fat lady sings.".   It is a good game, and I draw inspiration from both your's and Richard's solutions.

                                                   

                                                  So many ways to skin them, so few cats

                                                   

                                                  or is that, so many ways to kill them, so few lawyers?  

                                                   

                                                   

                                                  (WIWAC - When I Was At Cranwell)

                                                   

                                                  I added 1 to the results just to match the original request - Just having one of those moments, sorry!!!!!!

                                                   

                                                  Mike 

                                                   

                                                  Ah, OK.  I assumed it was because they were using ORIGIN=1.   The match solution should work, provided the function is defined where ORIGIN is 1.

                                                   

                                                  Stuart

                                                    • Re: Finding and Marking.
                                                      MikeArmstrong Diamond
                                                      So many ways to skin them, so few cats

                                                       

                                                      or is that, so many ways to kill them, so few lawyers?  

                                                       

                                                       

                                                      Ah, OK.  I assumed it was because they were using ORIGIN=1.   The match solution should work, provided the function is defined where ORIGIN is 1.

                                                      ORIGIN = 1 ----- Of course.

                                                       

                                                      Another moment where my brain cell got a little overloaded.

                                                       

                                                      Mike

                                    • Re: Finding and Marking.
                                      lvl107 Gold

                                          Stuart,

                                         My MC12 can open your attached file. Because of my poor English, I don't know about "vectorize" as yet. For now, I was interesting in match function go with "on error" operator working only one vector. In your worksheet, I see that the "vectorize" operator and the Output that it produces, is a powerful tools. I will study about that. I appreciate your explanation in that worksheet.

                                         Regards,

                                          Loi.    

                                      • Re: Finding and Marking.
                                        lvl107 Gold

                                        Stuart,

                                        A'.PNGD.PNGMark20DecIndex.PNG

                                        ( Finding the 20-decimal numbers match ( that means the first match, the second match and so on...) (only assume), and Replace them by their Row-index and Marking ) and see the attached.

                                          Regards, Loi.

                                         

                                         

                                          • Re: Finding and Marking.
                                            A.Non PTC Community Champion

                                            You can't do that, because you do not have enough digits of precision. You have only about 16 digits, so 0.1+1*10^-20 is just rounded off to 0.1 when it is stored.

                                            • Re: Finding and Marking.
                                              StuartBruff Platinum

                                              Loi Le wrote:

                                               

                                              Stuart,

                                              A'.PNGD.PNGMark20DecIndex.PNG

                                               

                                              ( Finding the 20-decimal numbers match ( that means the first match, the second match and so on...) (only assume), and Replace them by their Row-index and Marking ) and see the attached.

                                                Regards, Loi.

                                               

                                               

                                              As Richard says, the numeric processor won't handle that many digits due to the (IEEE standard) floating-point format that Mathcad uses to store numbers.   OTOH, you could use the symbolic processor ...

                                               

                                              Stuart

                                          • Re: Finding and Marking.
                                            MikeArmstrong Diamond

                                            It might be worth creating a document of all your latest requests. Each request is similar and would make it much easier if augmented into one document with a brief explanation of how each function works.

                                             

                                            You can create it or I will for you.

                                             

                                            Cheers

                                             

                                            Mike

                                            • Re: Finding and Marking.
                                              lvl107 Gold

                                              Thanks to all who replied.

                                                 Regards,

                                                   Loi Le.