Log24

Friday, June 14, 2024

For Chris Pine… Amazon Influencer
in “Wonder Woman 1984”

Filed under: General — Tags: — m759 @ 10:59 pm

Wonder Woman delivers a diamond

Another cultural inflection point:

Harrison Ford and Shia LaBeouf as Father and Son

Susan Sontag,
Notes on “Camp”

This post was suggested by an Instagram ad this evening —

UI/UX . . . Has Poolman Met His Match?

Filed under: General — Tags: , , — m759 @ 2:47 pm

"DeWanda Wise is the mysterious June del Rey
in #PoolmanMovie."

Summer of ’42: Python’s Monty

Filed under: General — Tags: — m759 @ 12:54 pm

From April 14, 2024,  some culture notes that I prefer —

An example of pi.ai's clear and pleasant conversational style
(output format simplified for presentation here) —


Can you help with computer coding problems?
 

Absolutely, Steven! 💻 While I can't guarantee I'll have all the answers, 
I'll certainly do my best to help you debug and find solutions to your 
coding conundrums. Which coding language are you working with, and what's 
giving you trouble?

 
I want to learn how Python can permute sections of a square array.
 

There are several ways to permute sections of a square array in Python, 
depending on your specific needs. Here are a few examples:

Using NumPy's random.permutation() function:

python

    import numpy as np

    arr = np.array([[1, 2], [3, 4]])
    permuted_arr = np.random.permutation(arr)

 

    Using itertools.permutations():

python

    import itertools

    arr = [[1, 2], [3, 4]]
    permutations = list(itertools.permutations(arr))

 

Using custom permutation algorithms:

python

    def custom_permutation(arr):
        # your custom permutation logic here

    arr = [[1, 2], [3, 4]]
    permuted_arr = custom_permutation(arr)

Each method has its own strengths and weaknesses, and which one 
you choose will depend on the size of your array, the number of 
permutations you need, and your performance requirements.


I would like to use python's custom permutation method to permute 
the four quadrants of a 4×4 array.

 
Here's an example of how to define a custom permutation function 
in Python to permute the four quadrants of a 4×4 array:
 
python

    def custom_permutation(arr):
        # Split array into 4 quadrants
        q1 = arr[:2, :2]
        q2 = arr[:2, 2:]
        q3 = arr[2:, :2]
        q4 = arr[2:, 2:]

        # Permute quadrants
        permuted_arr = np.block([
            [q3, q1],
            [q4, q2]
        ])

        return permuted_arr

    # Sample 4x4 array
    arr = np.array([[1, 2, 3, 4],
                    [5, 6, 7, 8],
                    [9, 10, 11, 12],
                    [13, 14, 15, 16]])

    permuted_arr = custom_permutation(arr)
    print(permuted_arr)

In this example, we've defined a function custom_permutation() 
that takes a 4×4 NumPy array as input. The function splits the array 
into four quadrants (q1, q2, q3, and q4), and then uses NumPy's block() 
function to create a new array with the quadrants permuted. The 
resulting permuted_arr array has its quadrants rearranged.

Of course, this is just one possible permutation of the array's quadrants. 
You can modify the custom_permutation() function to implement other 
permutations as needed.
 

I tried the code you gave me and got the error “np name not defined.”
 

Apologies for that! I missed an import statement in the previous example. 
You need to import the NumPy library at the beginning of your script to 
use the np alias and its functions. Here's the corrected code:
 
python

    import numpy as np

    def custom_permutation(arr):
        # Split array into 4 quadrants
        q1 = arr[:2, :2]
        q2 = arr[:2, 2:]
        q3 = arr[2:, :2]
        q4 = arr[2:, 2:]

        # Permute quadrants
        permuted_arr = np.block([
            [q3, q1],
            [q4, q2]
        ])

        return permuted_arr

    # Sample 4x4 array
    arr = np.array([[1, 2, 3, 4],
                    [5, 6, 7, 8],
                    [9, 10, 11, 12],
                    [13, 14, 15, 16]])

    permuted_arr = custom_permutation(arr)
    print(permuted_arr)

This code should work now without any issues.

It did work. Thank you, Pi. 

You're very welcome, Steven! I'm glad the code worked for you. 
If you have any more questions or need help with anything else, 
feel free to ask.

Theme Song: “Isn’t It Romantic?”

Filed under: General — Tags: — m759 @ 12:32 pm

Art Note: “You show me yours and . . . .”

Filed under: General — Tags: — m759 @ 12:04 pm

Thursday, June 13, 2024

Geek Story

Filed under: General — Tags: — m759 @ 11:45 am

Culture . . . or  Cult?

Filed under: General — Tags: — m759 @ 11:04 am

Wednesday, June 12, 2024

For the Triangle Theater

Filed under: General — Tags: , — m759 @ 9:48 pm

" he enrolled in the Dramatic Workshop of the New School and, in 1963,
created the Triangle Theater Company, where he directed productions and
appeared in 'The Adding Machine' ….

A New York Times  eulogy  for an actor who reportedly died yesterday.

When in Rome . . .

Scene  from  La Romana  (1954).

"It all adds up."

Tuesday, June 11, 2024

Theology for Geeks:  Claves Regni Caelorum

Filed under: General — Tags: , , , — m759 @ 11:54 am

A different approach . . .

A Discrete Process

Filed under: General — Tags: , , — m759 @ 12:05 am

For Flake513 Rose Ave., Venice, CA.

Monday, June 10, 2024

Art Logic

Filed under: General — Tags: , , , — m759 @ 11:06 am

The Wonder Woman tale in the previous post leads,
with impeccable logic, to . . .

Wonder Woman's Saddle Horn

For a Green* Apartment:  “Speak, Memory.”

Filed under: General — Tags: , , — m759 @ 10:16 am

* See a post of Saturday, May 18, 2024.

“Do You Like Apples?”

Filed under: General — Tags: , , — m759 @ 9:44 am

Manifest O

Filed under: General — Tags: , , , — m759 @ 9:31 am

"Old men ought to be explorers." — T. S. Eliot

"Every shade I choose is intentional, chosen to evoke specific feelings
within those who view my work. Blue strokes embody tranquility, a
gentle touch that calms the nerves like a whispered secret. Swirls of
red radiate a symphony of joy, love, and passion, inviting observers to
delve into the depth of human emotions. And then there’s orange —
a hue that signifies intelligence, dedication, activity, and enthusiasm —
a palette of emotions waiting to be explored."

— Marcela Nowak at Medium.com:

Powered by WordPress