Skip navigation
5523 Views 33 Replies Latest reply: Oct 29, 2010 6:16 PM by A.Non RSS
lvl107 Gold 335 posts since
Jan 22, 2007
Currently Being Moderated

Oct 27, 2010 5:27 PM

Finding and Marking.

  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-

Attachments:
  • StuartBruff Platinum 4,839 posts since
    Jun 1, 2007
    Currently Being Moderated
    Oct 27, 2010 6:20 PM (in response to lvl107)
    Re: Finding and Marking.

    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.

    Attachments:
    • MikeArmstrong Diamond 4,505 posts since
      Dec 3, 2008
      Currently Being Moderated
      Oct 28, 2010 12:00 AM (in response to StuartBruff)
      Re: Finding and Marking.

      Nice explanation Stuart.

       

      Lovely use of the mod function.

       

      Mike

      • StuartBruff Platinum 4,839 posts since
        Jun 1, 2007
        Currently Being Moderated
        Oct 28, 2010 12:50 AM (in response to MikeArmstrong)
        Re: Finding and Marking.

        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

        • A.Non Diamond 10,299 posts since
          May 11, 2010
          Currently Being Moderated
          Oct 28, 2010 6:32 AM (in response to StuartBruff)
          Re: Finding and Marking.

          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

          Attachments:
          • MikeArmstrong Diamond 4,505 posts since
            Dec 3, 2008
            Currently Being Moderated
            Oct 28, 2010 6:24 AM (in response to A.Non)
            Re: Finding and Marking.

            Nicely done.

             

            Have a look below, should your function be:-

             

            sss.jpg

            Mike

          • StuartBruff Platinum 4,839 posts since
            Jun 1, 2007
            Currently Being Moderated
            Oct 28, 2010 7:13 AM (in response to A.Non)
            Re: Finding and Marking.

            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

            Attachments:
            • MikeArmstrong Diamond 4,505 posts since
              Dec 3, 2008
              Currently Being Moderated
              Oct 28, 2010 7:50 AM (in response to StuartBruff)
              Re: Finding and Marking.

              Very nice.

               

              Can we stop adding additional functions / methods - I'm struggling to document all the examples

               

              Mike

            • A.Non Diamond 10,299 posts since
              May 11, 2010
              Currently Being Moderated
              Oct 28, 2010 8:26 AM (in response to StuartBruff)
              Re: Finding and Marking.

              Something like that, yes.

               

              Or perhaps

              numdigitsafter.gif

              • StuartBruff Platinum 4,839 posts since
                Jun 1, 2007
                Currently Being Moderated
                Oct 28, 2010 8:49 AM (in response to A.Non)
                Re: Finding and Marking.

                Richard Jackson wrote:

                 

                Something like that, yes.

                 

                Or perhaps

                numdigitsafter.gif

                 

                This colonial quest for efficiency is rubbing off on you, isn't it? 

                • A.Non Diamond 10,299 posts since
                  May 11, 2010
                  Currently Being Moderated
                  Oct 28, 2010 10:25 AM (in response to StuartBruff)
                  Re: Finding and Marking.

                  This colonial quest for efficiency is rubbing off on you, isn't it? 

                  Too right! One must be careful not to waste flops. Wasted flops means wasted energy, which leads to global warming and the end of the world as we know it!

                  • MikeArmstrong Diamond 4,505 posts since
                    Dec 3, 2008
                    Currently Being Moderated
                    Oct 28, 2010 11:36 AM (in response to A.Non)
                    Re: Finding and Marking.

                    While I am contemplating the prospect of the end of the world like we know!!! - have we reached the maximum of Mathcad's capability on this subject????

                     

                    Am I right to assume that both you and Stuart are still learning of each other?

                     

                    Mike

                    • A.Non Diamond 10,299 posts since
                      May 11, 2010
                      Currently Being Moderated
                      Oct 29, 2010 6:16 PM (in response to MikeArmstrong)
                      Re: Finding and Marking.

                      The majority of what I know about Mathcad I have learned from others that posted to the Collaboratory. Stuart is one of many. I am still leanring. That's a good thing, because if one is no longer learning then one are either senile or dead.

                  • StuartBruff Platinum 4,839 posts since
                    Jun 1, 2007
                    Currently Being Moderated
                    Oct 29, 2010 2:06 AM (in response to A.Non)
                    Re: Finding and Marking.

                    Richard Jackson wrote:

                     

                    This colonial quest for efficiency is rubbing off on you, isn't it? 

                    Too right! One must be careful not to waste flops. Wasted flops means wasted energy, which leads to global warming and the end of the world as we know it!

                     

                    Is this what happened to Jean?  Was he neglecting to balance his flips with some flops and getting overheated?  It certainly lead to the end of the Mathcad World as we knew it.    I suppose the question is are we mammals or dinOsaurs looking at that old meteor headed towards Chicxulub?

                     

                    Stuart

                     

                     

                    http://www.scienceclarified.com/scitech/images/lsca_0001_0001_0_img0031.jpg

                     

                    Err, Jean? Wakey, Wakey..  RUUUUNNNN!

                    • A.Non Diamond 10,299 posts since
                      May 11, 2010
                      Currently Being Moderated
                      Oct 29, 2010 6:15 AM (in response to StuartBruff)
                      Re: Finding and Marking.

                      http://www.scienceclarified.com/scitech/images/lsca_0001_0001_0_img0031.jpg

                       

                      Jean, burying your head in the sand won't help You said the calculations showed it would miss us! I told you we should have used units!

                      • StuartBruff Platinum 4,839 posts since
                        Jun 1, 2007
                        Currently Being Moderated
                        Oct 29, 2010 6:29 AM (in response to A.Non)
                        Re: Finding and Marking.

                        Richard Jackson wrote:

                         

                        http://www.scienceclarified.com/scitech/images/lsca_0001_0001_0_img0031.jpg

                         

                        Jean, burying your head in the sand won't help You said the calculations showed it would miss us! I told you we should have used units!

                         

                        ROFLMAO!!!! 

                         

                         

                         

                         

                        I wonder if Mr Lamb is still around? - I think he'd appreciate the astronomical and unit references

                      • MikeArmstrong Diamond 4,505 posts since
                        Dec 3, 2008
                        Currently Being Moderated
                        Oct 29, 2010 10:53 AM (in response to A.Non)
                        Re: Finding and Marking.
                        Jean, burying your head in the sand won't help You said the calculations showed it would miss us! I told you we should have used units!

                        Now now fellers.

                         

                        Mike

            • StuartBruff Platinum 4,839 posts since
              Jun 1, 2007
              Currently Being Moderated
              Oct 29, 2010 12:27 AM (in response to lvl107)
              Re: Finding and Marking.

              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

              Attachments:
              • MikeArmstrong Diamond 4,505 posts since
                Dec 3, 2008
                Currently Being Moderated
                Oct 29, 2010 12:59 AM (in response to StuartBruff)
                Re: Finding and Marking.

                Slight alternative attached.

                 

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

                 

                Mike

                Attachments:
                • StuartBruff Platinum 4,839 posts since
                  Jun 1, 2007
                  Currently Being Moderated
                  Oct 29, 2010 2:35 AM (in response to MikeArmstrong)
                  Re: Finding and Marking.

                  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

                  Attachments:
                  • MikeArmstrong Diamond 4,505 posts since
                    Dec 3, 2008
                    Currently Being Moderated
                    Oct 29, 2010 2:42 AM (in response to StuartBruff)
                    Re: Finding and Marking.

                    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 

                    • StuartBruff Platinum 4,839 posts since
                      Jun 1, 2007
                      Currently Being Moderated
                      Oct 29, 2010 3:12 AM (in response to MikeArmstrong)
                      Re: Finding and Marking.

                      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

                      • MikeArmstrong Diamond 4,505 posts since
                        Dec 3, 2008
                        Currently Being Moderated
                        Oct 29, 2010 10:51 AM (in response to StuartBruff)
                        Re: Finding and Marking.
                        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

      • A.Non Diamond 10,299 posts since
        May 11, 2010
        Currently Being Moderated
        Oct 29, 2010 6:31 AM (in response to lvl107)
        Re: Finding and Marking.

        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.

      • StuartBruff Platinum 4,839 posts since
        Jun 1, 2007
        Currently Being Moderated
        Oct 29, 2010 6:54 AM (in response to lvl107)
        Re: Finding and Marking.

        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

        Attachments:
  • MikeArmstrong Diamond 4,505 posts since
    Dec 3, 2008
    Currently Being Moderated
    Oct 28, 2010 12:11 AM (in response to lvl107)
    Re: Finding and Marking.

    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

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 3 points
  • Helpful Answers - 1 points