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

# Finding and Marking.

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

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

• ###### 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.

• ###### Re: Finding and Marking.

Nice explanation Stuart.

Lovely use of the mod function.

Mike

• ###### 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

• ###### 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

• ###### Re: Finding and Marking.

Nicely done.

Have a look below, should your function be:-

Mike

• ###### Re: Finding and Marking.

Oops! Good catch

I just fixed it and uploaded a new version of the worksheet.

• ###### 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

• ###### Re: Finding and Marking.

Very nice.

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

Mike

• ###### Re: Finding and Marking.

Something like that, yes.

Or perhaps

• ###### Re: Finding and Marking.

Richard Jackson wrote:

Something like that, yes.

Or perhaps

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

• ###### 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!

• ###### 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

• ###### 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.

• ###### 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

Err, Jean? Wakey, Wakey.. RUUUUNNNN!

• ###### 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!

• ###### Re: Finding and Marking.

Richard Jackson wrote:

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.

• ###### 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

• ###### Re: Finding and Marking.

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

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

• ###### 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.

( 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.

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.

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.

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.

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.
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.

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.

Stuart,

( 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.

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.

Loi Le wrote:

Stuart,

( 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.

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.

Oh, Yes, please, Mike. I don't have English enough to do that. I greatly appreciate your kindness.

Regards,

Loi.

• ###### Re: Finding and Marking.

Loi,

I will make a document with all the functions which have been posted in yours threads.

Have you any plans for more threads before I start

Mike

• ###### Re: Finding and Marking.

Mike,

You can start for now.

I greatly appreciate your kindness again.

Loi.

• ###### Re: Finding and Marking.

Thanks to all who replied.

Regards,

Loi Le.