## Squares

General FreeBASIC programming questions.
albert
Posts: 5916
Joined: Sep 28, 2006 2:41
Location: California, USA

### Re: Squares

@Dodicat

I got a formula , that seems to work...

n1 = mid( bits , a , 4 )

v1 = val( mid( n1 , 1 , 1 ) )
v2 = val( mid( n1 , 2 , 1 ) )
v3 = val( mid( n1 , 3 , 1 ) )
v4 = val( mid( n1 , 4 , 1 ) )

if v1 = 0 and v2 = 0 then outs1+= "0" : map1+= "0"
if v1 = 0 and v4 = 1 then outs1+= "0" : map1+= "1"
if v1 = 1 and v2 = 0 then outs1+= "1" : map1+= "0"
if v1 = 1 and v4 = 1 then outs1+= "1" : map1+= "1"

if v3 = 0 and v4 = 0 then outs1+= "0" : map1+= "0"
if v3 = 0 and v2 = 1 then outs1+= "0" : map1+= "1"
if v3 = 1 and v4 = 0 then outs1+= "1" : map1+= "0"
if v3 = 1 and v2 = 1 then outs1+= "1" : map1+= "1"

I switched the v2's and v4's ( v2 / v4 / v2 / v4 and v4 / v2 / v4 / v2 ) toggling them...
Compresses 15% on loop 1...

Now to figure out how to write a de-compressor...

It's a little confusing , how to undo it....

@CoderJeff ( Please don;t ban me for posting this... )
coderJeff
Posts: 3343
Joined: Nov 04, 2005 14:23
Contact:

### Re: Squares

albert wrote:@CoderJeff ( Please don;t ban me for posting this... )

albert
Posts: 5916
Joined: Sep 28, 2006 2:41
Location: California, USA

### Re: Squares

@CoderJeff

From your response , I take it , that it can't be undone....

Thank You...

I'll work on another formula..

Every few days i get a formula that compresses..
I spend about 6 hours a day , trying everything that i can think up...

If it doesn't compress , I try it on higher bytes.. if it doesn't compress at 10,000 bytes , I try 100,000 and 1,000,000 and 10,000,000 bytes..

10,000,000 bytes usually takes like a couple minutes or longer to per loop..

I've noticed that some formulas , that don't compress at 1,000 bytes , will compress at 100,000 bytes or higher..
But ; so far , none of them can be decompressed...

Maybe I'll take a break , and work some more on math programs...
deltarho[1859]
Posts: 2698
Joined: Jan 02, 2017 0:34
Location: UK

### Re: Squares

@albert

If you go to A Pseudorandom Number Sequence Test Program you will see a description of the program by John Walker. I beg to differ with the author in that I think it is very good for testing distribution uniformity but not randomness. For randomness I prefer PractRand. Anyway, the reason for mentioning John Walker's program is because one of the metrics used.

This is a typical output on examining a 50MB file.

Code: Select all

`Entropy = 7.999996 bits per byte. Optimum compression would reduce the sizeof this 52428880 byte file by 0 percent. Chi square distribution for 52428880 samples is 264.28, and randomlywould exceed this value 33.16 percent of the times. Arithmetic mean value of data bytes is 127.4859 (127.5 = random). Monte Carlo value for Pi is 3.141861901 (error 0.01 percent).Serial correlation coefficient is 0.000212 (totally uncorrelated = 0.0).`

Notice the second metric. Walker is making use of the fact that random data cannot be compressed. However, not being able to compress a file is a necessary condition for randomness but it is not sufficient. If the data was sorted it would still not compress but it would certainly not be random.

coderJeff wrote: "... compression of random data is impossible."

You wrote: "You can't look for patterns in random data.. You have to ( resort to ) , manipulating the element values.. by ( add , sub , mul , div , or , xor , and , imp , eqv ) or some combinations of them..
or shorting the binary value by removing the leading "1" : with a map.
or shorting the binary value by rtrim ( "0" or "1" ) : with a map."

The thing about random numbers is that whatever you do to them the result is still random. Most authors of random number generators do the opposite of what you are trying to do. They try to generate numbers such that the likelihood of a new number being associated with a previous number is small. This is what the Serial correlation coefficient is checking in John Walker's program. The above value of 0.000212 is not small enough for my liking - I want to see at least four zeros. The above was the result of checking the output of a Linear Congruential Generator which is known not to be fully random for all 32 bits of a 32-bit generator.

What you should be applauded for, albert, with all you tested methods is to show that random data cannot be compressed. Any further work will simply confirm what you have already shown us so there is no point in doing that.

So, what to do now? There are a few members of this forum who spend a lot of their time helping other members. That number is not great. At PowerBASIC we could see 10, and often more, members 'chipping in' to help someone. That can happen at FreeBASIC but is rare. You have been a member of the FreeBASIC forum since 2006 and probably know a lot more of the language than most, including me having joined in 2017. As a new project for you why not look at threads needing help to pass on some of your expertise. You obviously enjoy posting so you will benefit as well as those you help. There is a bonus to this suggestion - coderJeff will not send you packing to a black hole for helping others. Food for thought?
angros47
Posts: 1749
Joined: Jun 21, 2005 19:04

### Re: Squares

@deltarho[1859]

I fear you have no idea of how this thread developed. Albert received help, and explanations, from several other members, for years. And he repaid that help by not believing the answers he got, and asking the same questions again, and again. I, Richard, Dodicat and CoderJeff answered his questions: we explained (like you are also trying to do) that compression of random data is not possible. Albert didn't believe that. He replied something along the line "they said it was impossible to fly, but in the end some people had enough perseverance to succeed", so he persevered. And that would be fine. What is not fine is that he came back saying "Hey, guess what? My compression code doesn't work, what can I do to get it to work?". This is offensive, actually: it shows that he didn't listen a single word about what we tried to explain to him, and he keeps demanding to rell him how to get his program to work. I guess he think we know how to do that compression, and keep it secret just to spite him. And the worst thing is that this stuff is going on since 10 years. That's why I am saying to stop that. And if the only way to stop him is to ban him... well, let's ban him. And also CoderJeff seems to be thinking the same.
deltarho[1859]
Posts: 2698
Joined: Jan 02, 2017 0:34
Location: UK

### Re: Squares

angros47 wrote:I fear you have no idea of how this thread developed.

I do. When I was reading mathematics I had a hobby - psychology. I came very close to reading that full time. Punishing an autistic is not a solution for autism. My aim is to redirect the energy, not stifle it. Notice that I didn't criticize albert but applauded him. I agree with your remark to Richard and dodicat.
albert
Posts: 5916
Joined: Sep 28, 2006 2:41
Location: California, USA

### Re: Squares

How'd you guys know i had Autism??
I was born with Autism and then in my early 20's developed schizophrenia on top of it..

I think I'm pretty normal , coping with things... But the medicine I'm on ( Clozaril ( clozapine ) ) makes my mind a little muddy..
When they first put me on it , i was sleeping 22 hours a day.. Now after 10 years of it , I'm back to 8 to 10 hours a day of sleep...

I worry about the Clozaril med...
They say it's in the same class of drugs as Tegretol ( a brain cancer causing anti-epileptic used as a last resort in epileptics.. )
So I'm worried about getting brain cancer from it..

Did another 50 or so formulas today .. A couple were compressing , but produced outputs that matched other outputs...

I'll keep plugging along... Eventually I'll figure out a working formula...

Something has to work.....I just haven't thought of it yet.
albert
Posts: 5916
Joined: Sep 28, 2006 2:41
Location: California, USA

### Re: Squares

I remember back in my early 20's
I was playing with witchcraft...

I read through the "NecroNomicon" and "Sacred Magic Of Abra-Melin"
Two of the books they classify as the "Grand Grimoires"

I conjured a watcher from the NecroNomicon...
Then i conjured Jehovah and Lucifer from the Abra-Melin book..

Jehovah showed up as a clear orb with shifting spots all over it.. The spots ( eyes ) were rotating all around the orb..
Lucifer showed up as a black cloud , like a puff of black smoke from a semi tractor trailer at a stop light..

In the Bible they mention a black could filling the Jewish Temple.. That's Lucifer...He's the black cloud..

Jehovah told me he wouldn't work with Lucifer , and gave me 24 hours to decide which one i wanted to use..

Then my electric outlets started talking to me.. and anything that made noise was talking to me , out of the noise..
Talking fans , talking cars , talking lawn mowers , talking light bulbs....

So my schizophrenia , i think is that I think I'm demonized...
Sometimes when I'm walking outside , there's a rainbow circle on the ground around my shadow...Other people have witnessed it..
Richard
Posts: 3038
Joined: Jan 15, 2007 20:44
Location: Australia

### Re: Squares

angros47 wrote:Also, to Richard and dodicat: perhaps you should stop giving him any explanation, you are just feeding his illusions
I am not feeding Albert's illusions, I am grounding his delusions.
Albert is a member of this community. If anyone asks me a question I will treat them fairly and answer it the best way I can. You don't have to read his posts if you are not interested in watching his development.

Albert missed out on the introduction to algebra in school. I hope that one day, Albert will realise what algebra is, and why it is so simple compared to programming in FB.

Then he will understand and be able to explain, why and when; a = b * a / b.

Until then I am prepared to answer his questions, and will do my best to point him in the right direction.
If Albert is banned, we can't help him or watch his development.
BasicCoder2
Posts: 3596
Joined: Jan 01, 2009 7:03
Location: Australia

### Re: Squares

After reading Albert's last posts I can only agree with Richard. I know people with autism (or Asperger syndrome) and schizophrenia and they need understanding and kindness not rejection. I respect Richard's patience.

Albert I wouldn't worry too much about the side effects of clozapine, providing its possible side effects are properly monitored, as for many it appears to be the optimal medication. I know someone on clozapine who worries that one day his monthly blood test will come back with a low white blood count and he will have to go onto a less effective medication. It is lousy to have to be on a medication but it is no different to those with diabetes who have to check their blood sugar levels in order to monitor their insulin needs.
dodicat
Posts: 6726
Joined: Jan 10, 2006 20:30
Location: Scotland

### Re: Squares

I know nothing about psychology, my sister has a PhD in it, and apart from listening to a few rants over the years, that's about it for me.
However I can sympathise with Albert's other ailment, the lungs.
I believe Albert keeps physically active, long walks along the promenade e.t.c. and watching seagulls and contemplating wave motion and the like.
I try to do the same myself, but these last couple of weeks I have bogged down wheezing and coughing.
I have been walking the dogs in slow motion, and going up hills has been in the psychological equivalent of first gear.
I think I now have the gait of a moonwalker. I went to the Quack's surgery to be greeted by a closed sign on the door.
Emergencies to go to Accident and Emergency in town.
But I am no mood to moonwalk into A.and E.
So perhaps Albert could sympathise with me, if autism allows that, because he is well acquainted with lung problems.
But I do miss the old cigarettes though, there is nothing more relaxing than a good old puff of that blue haze, and a pint of ale
in the near foreground.
angros47
Posts: 1749
Joined: Jun 21, 2005 19:04

### Re: Squares

albert wrote:How'd you guys know i had Autism??

Likely you told them... when they mention it, I checked on the forum, you wrote it years ago

https://freebasic.net/forum/viewtopic.php?p=142705#p142705

I was born with Autism and then in my early 20's developed schizophrenia on top of it..

Sorry to hear, I didn't know

Richard wrote:Albert is a member of this community. If anyone asks me a question I will treat them fairly and answer it the best way I can. You don't have to read his posts if you are not interested in watching his development.

I respect you in that. And I usually try to do the same. I have tried to answer albert's questions, and I also helped him finding duplicates when he tested his algorithms. Point is, when I saw him asking the same questions that I had already answered, and trying only small variants of the same algorithms he has already tested, I had the impression that he totally ignored all the answer received.

If Albert is banned, we can't help him or watch his development.

Actually, I fear that is the point: we can't help him anyway, if he ignores the answers and keeps asking the same questions again and again. We are just running in circles, making no progress at all.
deltarho[1859]
Posts: 2698
Joined: Jan 02, 2017 0:34
Location: UK

### Re: Squares

dodicat wrote:but these last couple of weeks I have bogged down wheezing and coughing.

Don't ignore that. I cannot say for Scotland, but we can get a doctor's appointment online in England.
So perhaps Albert could sympathise with me, if autism allows

No, it doesn't.
albert
Posts: 5916
Joined: Sep 28, 2006 2:41
Location: California, USA

### Re: Squares

This formula compresses 70% after 100 loops...

coderJeff
Posts: 3343
Joined: Nov 04, 2005 14:23
Contact:

### Re: Squares

Albert, know your limitations. Notice that help is offered. Whenever we seem to be close to a meaningful connection the opportunity is missed by your own undoing. By suspending your access here I will hope for the best that you will seek meaningful help elsewhere.

If you insist on posting about compression then there is at least 2 things that need to happen if you wish to avoid suspension:
- you *must* consider the possibility that lossless compression of random data is impossible
- that there are a number of fine folks here trying to help you - look and listen closer to what they are saying before posting anything