Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

http://reference.wolfram.com/mathematic … Image.html

Can I count the number of balls in my monte carlo simulation model that I posted in the other thread?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 96,625

Hi;

Post processing will not beat pre-processing in this case.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

Offline

I beg your pardon?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 96,625

Sorry, I forgot that in your case this does not apply.

Enter this:

Dimensions[circles]

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

Offline

In a new notebook?

That returns the same thing because circles is not defined

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember

Offline

The problem is to count the number of circles inside the quadrant and outside the quadrant in this picture?

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 96,625

Each help page is a notebook. Most of the time you can run the cells as if you had entered them. You can also add your own commands.

But to make life easier for you right now copy the commands to a new notebook and run them. Tell me when you have completed that task.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

Offline

```
In[3]:= Dimensions[circles]
Out[3]= {}
```

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 96,625

Did you copy the help commands and run them?

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

Offline

What commands are you talking about?

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 96,625

The OP has posted a link. In[58] and In[59] are called cell labels. They are the names of the cells that have the commands that generated Out[61]. Highlight In[58] and In[59] and copy them to a new notebook.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

Offline

I've already tried doing it and it works. But why do you want me to do that?

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 96,625

Did you run

Dimensions[circles]

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

Offline

After that? No

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 96,625

Can I count the number of balls in my monte carlo simulation model that I posted in the other thread?

If you run Dimensions[circles] after running the other two that question will be answered.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

Offline

Using which picture? That of the cells or my model?

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 96,625

There are 2 cells that need to run. They are in M's help. Copy and paste them. Then run them. Then you run the command I posted to you.

From there we can try to answer the OP's question.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,084

Hi,

I'm really only watching this thread because although the topic's too advanced for me I'm interested in the idea of M counting shapes in an image...just out of curiosity.

Here's an image of what I did in M.

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 96,625

Hi;

Did you see the result of the Dimensions command? Notice the first number which is 31.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,084

Hi Bobby,

Yes, I did see the result of the Dimensions command, and noticed that the first number (31) is the count of the red circles. What does the '2' represent?

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,084

This is the result I got when replacing the OP's 'drawing' with an image of it taken from the OP's page.

I suppose the reduction in the sharpness of the image accounts for the discrepancies in circle identification when compared with the original. The count being the same would be a fluke.

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 96,625

Hi;

The two tells us it is an array of 31 elements of 2 each.

I would say the 31 is a coincidence in the smeared out drawing. But it is not in the sharp image.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

Offline

Who is OP?

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember

Offline

**phrontister****Real Member**- From: The Land of Tomorrow
- Registered: 2009-07-12
- Posts: 4,084

Hi Agnishom

Who is OP?

I don't know...was just following bobbym's lead in post #11.

bobbym wrote:

I would say the 31 is a coincidence in the smeared out drawing. But it is not in the sharp image.

phrontister wrote:I suppose the reduction in the sharpness of the image accounts for the discrepancies in circle identification when compared with the original. The count being the same would be a fluke.

I increased the size of the OP's original image with ImageResize[i, {420, 280}] - those are the output dimensions - and copied the resized image with a screen capture using SnagIt...which came up nice and sharp. I replaced the code's image with SnagIt's, quit M, reran M and got exactly the same result as the original.

This was just to test the program on an actual imported image.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 96,625

Hi;

OP means original poster.

**In mathematics, you don't understand things. You just get used to them.**

**If it ain't broke, fix it until it is.**

Offline