I got a new road bike!

by SirCalcsALot, Apr 23, 2021, 2:44 AM

First road bike! I've always had a mountain bike but I wanted to get into road cycling more.
https://media.discordapp.net/attachments/771173883906752552/833533426254086194/unknown.png?width=267&height=200

It's a 2018 Cannondale Supersix Evo with Shimano Dura-Ace drivetrain. I actually bought it used, but it's a new bike for me. Now it's time to spend even more money to get road cycling gear.

The MathJam...

by SirCalcsALot, Jan 27, 2021, 1:49 AM

Thanks to the AoPS devs for getting the classroom working so the mathjam could take place. :)

Just going to put this here:
https://cdn.artofproblemsolving.com/attachments/6/1/c164f3e39333731bb3e3025cb45675956cd16c.png

Pendulum Art Avatars

by SirCalcsALot, Nov 30, 2020, 2:12 AM

Hello! :D

I've got some more simulations of pendulum art, and I decided to turn some of the results into avatars. Feel free to use any that you like! :) You can save images by right clicking on them and pressing 'Save Image As..' (at least, that's how it works on chrome).

Here are the 10 avatars I created. The sizes are a bit off, but I tested that these all work as avatars.

#1:
https://cdn.artofproblemsolving.com/attachments/e/7/b23d2f4544dc30a9f769c6d65ff86ab1a895c7.png

#2:
https://cdn.artofproblemsolving.com/attachments/c/9/0da883ed8fb70227226d8f0d6d90e8bd120ff5.png

#3:
https://cdn.artofproblemsolving.com/attachments/a/6/cc5d786a0f30d7d78437fe7646cff0c13bca99.png

#4:
https://cdn.artofproblemsolving.com/attachments/7/f/360b93f61b1316531703e81745accaf64d6c3c.png

#5:
https://cdn.artofproblemsolving.com/attachments/7/7/39099fe87c847c7b9d2de217f1d3a4ac56a52f.png

#6:
https://cdn.artofproblemsolving.com/attachments/6/b/22f918aaaa05682994f30dd37a7cc3a7b0a6e9.png

#7:
https://cdn.artofproblemsolving.com/attachments/b/e/78aa9ffd0568ed00f7cb440439b48f834c4ccf.png

#8:
https://cdn.artofproblemsolving.com/attachments/0/6/a24781245dbaf338d442104fe6dafbdd394c75.png

#9:
https://cdn.artofproblemsolving.com/attachments/f/0/4cb716b84237b57f428d5dbb87da6080eeb00f.png

#10:
https://cdn.artofproblemsolving.com/attachments/a/0/eaa807489a9732b28096e0e50e5adc7500bb7f.png

If you have a specific orientation or colors that are not shown, let me know in the comments and I might be able to make a custom avatar for you. ;)

Virtual Pendulum Art

by SirCalcsALot, Nov 26, 2020, 4:56 AM

Hi all!

It's been a while since I've posted, but I've gotten busy with college and haven't had a chance to mess with the night vision project too much. In the meanwhile, I thought I would share the results of some code I wrote (with a teammate) for my Programming for Physicists class.
https://media.discordapp.net/attachments/745759430175621162/781036154535018506/animation.gif

As you can see above, we are working on building a computational model for pendulum art. Based on the results we have achieved, I think we need to move from writing code to to writing our presentation slides... :|

It's pretty cool what you can do with 300 lines of C++ code and 60 lines of Python code. :)

I made night vision!1!!!iI!i!

by SirCalcsALot, Oct 17, 2020, 7:04 PM

Yay, the parts I've been waiting for finally came. After a bit of time tinkering with the parts, computer code, circuit diagrams, and tape, my first night vision prototype is complete.

Introducing: Night Vision Beta Version Prototype v.1.-1
https://cdn.artofproblemsolving.com/attachments/6/5/b74d4b088e2873559e174760a5c3e96e9f33d6.jpg

Don't try this at home. For those who are curious on how it's built, see the instructional image below (more details coming out in a later post, maybe).
https://cdn.artofproblemsolving.com/attachments/7/2/b9b2c3ef8e827433ddf4b327268fea907fa451.jpg

Now, here are some images of the night vision in action.

First, here are my cats. (Note that ultrasound doesn't bounce well off kitties which is why the range isn't accurate.) G.G.Otto says that I was blasting them with sound and light and they don't even know. :evilgrin:
https://cdn.artofproblemsolving.com/attachments/e/5/f35fd963f6c91b263ddf5202ea887f22bfc82c.jpg

Next, a lawnmower that's been sitting in my yard for so long we had to weedwack around it. (Notice that ultrasound does bounce nicely off broken down lawnmowers...)
https://cdn.artofproblemsolving.com/attachments/1/6/6e8d91232f26ae67ee17d7338a7fdf0d62dda3.jpg

Finally, here's my jungle. There probably is 96 ft 7 in off empty space in front of me, so I guess the range finder works?!?
https://cdn.artofproblemsolving.com/attachments/4/5/f9cca54018ea25e3707ba1fd2c57d6a2607219.jpg

Stay safe, and see you next time!

(Inspiration for this project came from Star Wars: the Mandalorian. Sadly, cheap thermal cameras are out of stock due to covid.)

NxNxN Default Generator

by SirCalcsALot, Aug 27, 2020, 3:49 AM

As requested by sonone, here is my code to my NxNxN default generator. I don't have time to explain the code, so you'll have to figure out how it works on your own. Feel free to ask in questions in the comments though! This code is in an incomplete state since the project got put on the back burner and I forgot about it. Add extra features if you want! :)

Suggestion for anyone interested: try to make it where the stacking doesn't result in a 'drop off'. The code currently doesn't generate avatars uniformly.

Tip: avatars larger than 20 x 20 x 20 will likely time out on AoPS.

[asy]
size(5cm,5cm);
/*
CREATED BY SIRCALCSALOT
BASED OFF SONONE'S 3x3 SELECTIVE DEFAULT GENERATOR
DO NOT USE WITHOUT PERMISSION
CODE MAY BE HARD TO TAMPER WITH
SO STORE IN AN AIRTIGHT CONTAINER
THANKS!
*/

srand(seconds());

import three;
currentprojection=orthographic(3,3,3);

//++++ customization ++++
pen top = rgb(153/255,200/255,99/255);
pen left = rgb(254/255,245/255,182/255);
pen right = rgb(27/255, 135/255, 212/255);
pen edges=invisible; // invisible recommended for large cubes
int max_side = 23;
int max_rand_side = 23;
int rand_colors = 1;
int rand_shape = 1;
int rand_side = 0;
int rand_bg_color = 0;

int[][] custom_heights = {
{3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};

//++++ end customization ++++

/* BEGIN MADE BY SIRCALCSALOT */
if (rand_side == 1) {
    max_side = rand() % max_rand_side + 1;
}

if (rand_colors == 1) {
    top = rgb((rand()%256)/255, (rand()%256)/255,(rand()%256)/255);
    left = rgb((rand()%256)/255, (rand()%256)/255,(rand()%256)/255);
    right = rgb((rand()%256)/255, (rand()%256)/255, (rand()%256)/255);
}

if (rand_bg_color == 1) {
    edges = edges + rgb((rand()%256)/255, (rand()%256)/255, (rand()%256)/255);
}

if (max_side >= 4) {
    edges = edges + linewidth(0.5);
}

if (max_side >= 9) {
    edges = edges + linewidth(0.25);
}
/* END MADE BY SIRCALCSALOT */


/* MADE BY SONONE */
path3 leftface=(1,0,0)--(1,1,0)--(1,1,1)--(1,0,1)--cycle;
path3 rightface=(0,1,0)--(1,1,0)--(1,1,1)--(0,1,1)--cycle;
path3 topface=(0,0,1)--(1,0,1)--(1,1,1)--(0,1,1)--cycle;

for(int i=0; i<max_side; ++i){
for(int j=0; j<max_side; ++j){

draw(shift(i,j,-1)*surface(topface),top,nolight);
draw(shift(i,j,-1)*topface,edges);

draw(shift(i,-1,j)*surface(rightface),right,nolight);
draw(shift(i,-1,j)*rightface,edges);

draw(shift(-1,j,i)*surface(leftface),left,nolight);
draw(shift(-1,j,i)*leftface,edges);

}
}

picture CUBE;
draw(CUBE,surface(leftface),left,nolight);
draw(CUBE,surface(rightface),right,nolight);
draw(CUBE,surface(topface),top,nolight);
draw(CUBE,topface,edges);
draw(CUBE,leftface,edges);
draw(CUBE,rightface,edges);
/* END MADE BY SONEONE */

/* BEGIN MADE BY SIRCALCSALOT */

int[][] heights = new int[max_side][max_side];
for (int i = 0; i < max_side; ++i) {
    for (int j = 0; j < max_side; ++j) {
        heights[i][j] = 0;
    }
}


for (int i = 0; i < max_side; ++i) {
    heights[i][max_side-1-i] = rand() % (max_side+1);
}

for (int k = 1; k < max_side; ++k) {
    for (int i = 0; i < max_side - k; ++i) {
        heights[i][max_side-1-k-i] = max_side - rand() % (max_side + 1 - max(heights[i+1][max_side-1-k-i],heights[i][max_side-k-i]));
    }
}

for (int k = 1; k < max_side; ++k) {
    for (int i = k; i < max_side; ++i) {
        int above = heights[i][max_side-i-1+k-1];
        int leftof = heights[i-1][max_side-i+k-1];
        heights[i][max_side-i+k-1] = rand() % (min(above,leftof) + 1);
    }
}

/*    for (int i = 1; i < max_side; ++i) {
        int above = heights[i][max_side-i-1];
        int leftof = heights[i-1][max_side-i];
        heights[i][max_side-i] = rand() % (min(above,leftof) + 1);
    }
    
    for (int i = 2; i < max_side; ++i) {
        int above = heights[i][max_side-i-1+1];
        int leftof = heights[i-1][max_side-i+1];
        heights[i][max_side-i+1] = rand() % (min(above,leftof) + 1);
    }*/

if (rand_shape == 0) {
    for (int i = 0; i < max_side; ++i) {
        for (int j = 0; j < max_side; ++j) {
            heights[i][j] = custom_heights[i][j];
        }
    }
}


for (int i = 0; i < max_side; ++i) {
for (int j = 0; j < max_side; ++j) {
for (int k =0; k < min(heights[i][j], max_side); ++k) {
add(shift(i,j,k)*CUBE);
}
}
}

real a = 2*max_side/3;
draw((0,0,0)--(0,0,sqrt(3)*a),invisible);
draw((0,0,0)--(0,0,-sqrt(3)*a),invisible);
draw((0,0,0)--(-a,a,0),invisible);
draw((0,0,0)--(a,-a,0),invisible);

/* END MADE BY SIRCALCSALOT */

[/asy]

A code to make a code to make a code...

by SirCalcsALot, Aug 15, 2020, 9:08 PM

Hi everyone! It's been a while since my last post, but I finally finished another project I can share.

I saw a post by sonone on the LaTeX and Asymptote that showed a random QR code made with Asymptote. Since QR codes have certain rules, so I thought I'd attempt at making a scannable QR code with Asymptote. It turns out Python was easier to work with, so I implemented the main algorithm with and had Python print the Asymptote code to draw the QR code. And that's where the title of my post comes in, I made a Python code to write Asymptote code to draw a QR code. :o

Anyway, here is the code for anyone curious: QR Code Generator. To use the code, simply run the program and enter a valid string that is less than 45 characters in length. You can only enter strings with valid characters: 0-9, A-Z (capital only), and a few special characters such as :, /, ., and +. For this, reason the QR code is a little limited in the types of urls you can link with it. I ended up having to use a link shorten (bit.ly to be precise) to get links to certain websites to work.

To actually generate the QR codes, I used this tutorial. My QR code generator is just the tip of the iceberg! The code is a bit long since I ended up using a lot of dictionaries to store tables instead of actually computing the numbers in those tables. In principle, these are the steps you need to take when generating a QR code:
  • Encode the given data as binary.
  • Find the error correction code words and code those in binary.
  • Place the data and error correction code words in the matrix.
  • Add required blocks such as the finders (big squares at the corners).
  • Add the format data to tell what version and mask is used.
  • Apply a data ask to make the code easier to process.

QR codes are pretty handy since it makes it really easy to share data quickly on the fly! You can also set your profile picture to a QR code of something you want to advertise. That's free advertising space on every post you make! ;)

Fun fact: Python already has a module to generate QR codes called pyqrcode. You can download it using the command pip3 install pyqrcode (no guarantees, but that's what worked on my Raspberry Pi).

Here are a few example QR codes generated with my code.
Figure 1: Version 1 QR Code (up to 25 alphanumeric characters) containing the text "HELLO WORLD"
[asy]
int[][] qrdata = {{1,1,1,1,1,1,1,0,1,1,0,0,1,0,1,1,1,1,1,1,1},
{1,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,0,0,0,1},
{1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,0,1},
{1,0,1,1,1,0,1,0,1,0,0,1,0,0,1,0,1,1,1,0,1},
{1,0,1,1,1,0,1,0,1,1,1,0,0,0,1,0,1,1,1,0,1},
{1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1},
{1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1},
{0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0},
{1,1,1,1,0,0,1,0,1,0,1,0,0,1,0,0,1,1,1,0,0},
{1,0,0,0,0,0,0,1,0,0,0,0,1,1,0,0,1,1,1,1,0},
{0,1,1,0,1,0,1,1,1,1,1,0,1,1,0,1,0,0,0,1,1},
{1,1,1,1,0,0,0,0,1,1,0,0,1,0,1,1,0,0,0,1,1},
{0,1,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,1,1,0},
{0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,1,0,0,0,0,0},
{1,1,1,1,1,1,1,0,0,1,0,0,0,1,1,1,1,0,1,0,1},
{1,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,0,1,0,0,1},
{1,0,1,1,1,0,1,0,0,1,0,1,0,0,1,1,0,0,1,1,1},
{1,0,1,1,1,0,1,0,1,1,1,0,0,1,0,0,0,0,0,1,0},
{1,0,1,1,1,0,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0},
{1,0,0,0,0,0,1,0,1,0,0,1,1,0,1,1,1,0,0,0,0},
{1,1,1,1,1,1,1,0,1,1,0,1,1,1,0,0,1,1,1,1,0},
};
int side = 21;filldraw((-4, 4)--(-4,-(side+4))--(side+4, -(side+4))--(side+4, 4)--cycle, white);
                for (int i = 0; i < side; ++i) {
                    for (int j = 0; j < side; ++j) {
                        if (qrdata[j][i] == 1) {
                            fill((i, -j)--(i+1,-j)--(i+1,-j-1)--(i,-j-1)--cycle, black);
                        }
                    }
                }
[/asy]
Figure 2: Version 2 QR Code (up to 47 alphanumeric characters) containing the url "HTTPS://BIT.LY/SIRCALCSALOTSBLOG"
[asy]
int[][] qrdata = {{1,1,1,1,1,1,1,0,1,0,1,0,1,1,0,1,1,0,1,1,1,1,1,1,1},
{1,0,0,0,0,0,1,0,0,1,1,1,1,0,1,1,1,0,1,0,0,0,0,0,1},
{1,0,1,1,1,0,1,0,1,1,1,0,0,0,1,1,1,0,1,0,1,1,1,0,1},
{1,0,1,1,1,0,1,0,1,1,1,0,1,1,0,1,1,0,1,0,1,1,1,0,1},
{1,0,1,1,1,0,1,0,1,0,0,1,1,0,1,1,0,0,1,0,1,1,1,0,1},
{1,0,0,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,1,0,0,0,0,0,1},
{1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1},
{0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0},
{1,1,1,1,0,0,1,0,1,0,1,1,1,0,0,0,1,1,0,0,1,1,1,0,0},
{1,0,1,0,1,0,0,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,0,0,0},
{1,0,1,1,0,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1,0,1,0,0,0},
{1,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,0,1,1,0,1,1,1,0,1},
{0,0,0,1,1,1,1,0,0,1,1,0,1,0,0,0,0,1,0,0,1,1,0,0,0},
{0,0,1,1,1,1,0,1,0,1,0,1,1,0,0,1,1,0,0,1,1,1,0,1,1},
{0,1,0,1,0,1,1,0,1,1,1,1,0,0,0,1,1,1,0,1,0,0,0,0,1},
{1,0,1,1,0,0,0,1,0,1,0,1,0,0,0,1,1,1,1,0,1,1,0,1,1},
{0,0,0,0,1,0,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
{0,0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,1,0,0,0,1,1,0,1,1},
{1,1,1,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,1,0,1,0,0,0,1},
{1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,1,1,0,0,0,1,1,1,1,0},
{1,0,1,1,1,0,1,0,0,0,1,0,0,1,0,0,1,1,1,1,1,1,1,0,0},
{1,0,1,1,1,0,1,0,1,1,0,0,0,0,0,1,0,0,0,0,1,1,0,1,1},
{1,0,1,1,1,0,1,0,1,1,0,0,0,0,1,1,0,0,1,0,0,0,1,1,0},
{1,0,0,0,0,0,1,0,1,0,1,1,1,1,0,1,1,1,0,0,0,0,1,0,1},
{1,1,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,1,0,0,1,0,0,1},
};
int side = 25;filldraw((-4, 4)--(-4,-(side+4))--(side+4, -(side+4))--(side+4, 4)--cycle, white);
                for (int i = 0; i < side; ++i) {
                    for (int j = 0; j < side; ++j) {
                        if (qrdata[j][i] == 1) {
                            fill((i, -j)--(i+1,-j)--(i+1,-j-1)--(i,-j-1)--cycle, black);
                        }
                    }
                }
[/asy]
Figure 3: Version 5 QR Code (up to 154 alphanumeric characters) containing the text "IT IS A PERIOD OF CIVIL WAR. REBEL SPACESHIPS STRIKING FROM A HIDDEN BASE HAVE WON THEIR FIRST VICTORY AGAINST THE EVIL GALACTIC EMPIRE."
[asy]
int[][] qrdata = {{1,1,1,1,1,1,1,0,1,0,1,0,1,0,0,0,1,0,1,1,1,0,1,0,1,0,0,1,0,0,1,1,1,1,1,1,1},
{1,0,0,0,0,0,1,0,0,1,1,1,1,0,0,1,0,0,0,0,1,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1},
{1,0,1,1,1,0,1,0,1,1,1,0,0,0,1,0,1,0,1,0,0,0,1,1,0,0,0,1,1,0,1,0,1,1,1,0,1},
{1,0,1,1,1,0,1,0,1,1,1,0,1,0,0,0,0,1,1,1,0,0,1,0,0,0,1,1,0,0,1,0,1,1,1,0,1},
{1,0,1,1,1,0,1,0,1,0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,0,0,1,0,1,0,1,0,1,1,1,1,0,1,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0},
{1,0,1,1,1,0,1,0,0,1,1,1,1,1,0,1,0,1,0,0,0,0,0,1,1,1,0,0,1,1,1,1,1,0,0,1,0},
{1,0,1,1,1,0,1,0,1,0,0,0,1,1,0,0,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,0,1},
{1,0,1,1,1,0,1,0,1,0,0,1,1,1,0,1,0,1,0,0,1,1,0,0,1,0,1,0,0,0,1,1,1,0,0,0,0},
{1,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,1,1,0,0,0,1,1,1,1,1,0,0,0,1,1,1,0,1,1,0,1},
{1,1,1,1,1,1,1,0,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,0,0,1,0,1},
};
int side = 37;filldraw((-4, 4)--(-4,-(side+4))--(side+4, -(side+4))--(side+4, 4)--cycle, white);
                for (int i = 0; i < side; ++i) {
                    for (int j = 0; j < side; ++j) {
                        if (qrdata[j][i] == 1) {
                            fill((i, -j)--(i+1,-j)--(i+1,-j-1)--(i,-j-1)--cycle, black);
                        }
                    }
                }
[/asy]
Figure 4: Version 5 QR Code (up to 154 alphanumeric characters) containing the text "ONE LAST EXAMPLE"
[asy]
int[][] qrdata = {{1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,1,1},
{1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,1},
{1,0,1,1,1,0,1,0,1,0,0,1,1,1,1,1,0,0,1,0,1,0,0,1,1,1,1,1,0,0,1,0,1,1,1,0,1},
{1,0,1,1,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,0,0,1,0,1,0,1,1,1,0,1},
{1,0,1,1,1,0,1,0,1,1,1,1,0,1,0,0,0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,0,0,0,0,0,1,1,0,1,0,1,1,0,1,0,0,0,1,0,0,1,0},
{1,0,1,1,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,0,0,0,0,0,1,1,0,1,1,1,1,1,0,1,1,1},
{1,0,1,1,1,0,1,0,1,1,1,0,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1},
{1,0,1,1,1,0,1,0,1,0,1,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0},
{1,0,0,0,0,0,1,0,1,0,1,1,1,1,1,1,0,0,1,0,1,0,0,1,1,1,1,0,1,1,1,1,1,1,1,0,1},
{1,1,1,1,1,1,1,0,1,1,1,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,0,0,1,0,0,1,0,0,1,0,1},
};
int side = 37;filldraw((-4, 4)--(-4,-(side+4))--(side+4, -(side+4))--(side+4, 4)--cycle, white);
                for (int i = 0; i < side; ++i) {
                    for (int j = 0; j < side; ++j) {
                        if (qrdata[j][i] == 1) {
                            fill((i, -j)--(i+1,-j)--(i+1,-j-1)--(i,-j-1)--cycle, black);
                        }
                    }
                }
[/asy] Let me know if you have any questions about using my QR code generator or generating QR codes in general.

"Drawing" the AoPS Logos with Python Turtle

by SirCalcsALot, Jul 18, 2020, 5:09 AM

Hi! :D

I saw a competition to draw the best AoPS Online Logo with turtle on a private forum. CaptainFlint suggested that instead of drawing the logo, he could take it from the AoPS website. I decided to steal his idea and program this concept myself. I'm not submitting this as part of the competition for two reasons: collaboration was not allowed and all the program does is steal the logo from the website and display it with turtle.

Here is the code! The idea behind the code is as follows:
  1. Navigate to the url of the image and download it as an .svg file.
  2. Convert this .svg file to a .gif file since turtle can only display gif's.
  3. Move the turtle to the correct location and change it's shape to the gif file.
  4. Finally, repeat these steps for the other three logos
Because of the repetitive tasks, this was perfect for using functions, lists, and loops. At the end of the program, all local versions of the image files are deleted from the computer using the os module. I had to install the svglib module to do the conversion from an svg to gif. Since several extra packages are used, this won't even run in IDLE. I did the programming with Spyder Anaconda IDE since it was much easier to install packages. Google is a programmer's best friend, so take advantage of that when trying new projects.

I've attached the resulting turtle drawing to this post. Enjoy! :D
Attachments:

RSA Encryption Program with Assembly!!

by SirCalcsALot, Jul 16, 2020, 5:54 PM

Hello everyone!

I thought I would share the RSA encryption program I've mentioned in a previous post. It is written in ARM assembly and can process RSA encryption of up 400 bits, with a max 31 bit key length. Because of the short key length, it is very unsecure and can be easily hacked with something like Wolfram Alpha. I designed this code as a final project for my engineering class on microprocessors and assembly language.

Here are a few things about the code:
  • Assembly uses something called registers to manipulate data. We have 12 registers we can use that act as our twelve possible variables. Each register can hold a maximum of 32 bits, so in some places I needed two registers to work with 64 bit numbers.
  • Since we only have 12 variables, sometimes we have to push data into the stack to save it for later when we need to access it again.
  • The version of ARM assembly I was using doesn't have a moduluo operator, so I had to implement my own.
  • To perform the operation $a^b \mod c$, I implemented a semi-fast algorithm. Initially I used a recursive approach, but I had to switch to an iterative approach due to memory constraints.

I've attached the report I wrote up to submit for my project (I had to split it into pieces because of the max file limit on AoPS). The report talks a bit more about the algorithms used as well as shows some test cases. If you look carefully, you will notice that I cited Wikipedia in this report since that is were I got one of my algorithms! :o

Since the code is over 100 lines, I've included it in a hide tag. Feel free to ask me any questions about the code or assembly in general. Assembly really takes you down to the lower levels of programming and you need to think about things like
  • How functions work and how do you return something from a function.
  • How lists work (we actually need an address as well as the number of items in the list).
  • How variables work. Some variables point to actual values in memory. Others point to the address in memory that the data is at.

Click to see code

I'll try to answer any question you all might have on assembly, so feel free to ask if you want to know about something. Enjoy the code! :D

(Since I could only attach three files, the first appendix with the code is here and the second appendix with a longer test is here. Let me know if you have issues with these links.)
Attachments:
conclusion_referecnes.pdf (230kb)
report_v2_compressed1.pdf (481kb)
report_v1_compressed.pdf (426kb)
This post has been edited 3 times. Last edited by SirCalcsALot, Jul 16, 2020, 6:25 PM

So apparently there is a lot of math research on "default avatars"

by SirCalcsALot, Jul 15, 2020, 2:07 AM

Hey everyone!

This is just a quick update but I was looking into default avatars in a little more detail. It turns out their official name is "plane partitions" and I recommend taking a look at the Wikipeida page on plane partitions. I also found out that there has been research done on an algorithm to sample random plane partitions.

You might also be interested in Lozenge tiling which is a view of plane partitions in a two dimensional view! I'll probably post more about this after my summer engineering class ends and I have more time on my hands.

Let me know if you have any questions!

This is a place for me to put interesting programs and problems (maybe some electrical engineering too!). To see Asymptote codes, use the Asymptote tag.

avatar

SirCalcsALot
Shouts
Submit
  • Wait they were your old classmate
    dang
    also hi SCAL

    by the_mathmagician, Apr 9, 2022, 4:59 PM

  • hello old classmate!

    by RedFlame2112, Nov 10, 2021, 12:17 AM

  • this is the best blog ive ever seen on aops. respect

    by Anaxagoras, Oct 4, 2021, 7:08 PM

  • orz orz orz orz

    by cubingsoda, Aug 3, 2021, 5:27 AM

  • I really like this blog for some reason.

    by AndrewC10, Jul 31, 2021, 4:59 AM

  • who, me?

    by Bachsonata3, Jun 19, 2021, 6:06 PM

  • :O I found you

    by leapftstars, Jun 19, 2021, 6:02 PM

  • can I be contrib? sircalcs pro orz orz orz

    by Bachsonata3, Jun 19, 2021, 5:21 PM

  • One of my favorite helpers :D nice bike btw!

    by AlwaysOnce, May 22, 2021, 3:19 AM

  • sircalcsalot is the best :omighty:

    by pith0n, May 20, 2021, 5:25 AM

  • HELLO!!!!!! :D :D

    by cubingsoda, Apr 15, 2021, 8:00 PM

  • Hello everyone! Nice blog!

    by shadow09, Mar 17, 2021, 2:15 PM

  • @below you got the 100th shout :P

    by player01, Feb 2, 2021, 8:39 PM

  • Hi SirCalcsALot! :-D

    by aops-g5-gethsemanea2, Jan 11, 2021, 12:03 PM

  • Thanks! I'll probably return to my original avatar after the holidays are over.

    by SirCalcsALot, Dec 3, 2020, 11:15 PM

113 shouts
Contributors
Tags
About Owner
  • Posts: 4021
  • Joined: Jun 28, 2014
Blog Stats
  • Blog created: Feb 13, 2015
  • Total entries: 43
  • Total visits: 13027
  • Total comments: 238
Search Blog