Moving average of Hare Krishna Sequence

Published: 21 May 2024| Version 1 | DOI: 10.17632/xd583b67h9.1
Contributor:
Sunil Maria Benedict

Description

This code explores the Hare Krishna mantra sequence by converting it into numerical values and performing cumulative sum and moving average analyses to uncover its structural patterns. The mantra sequence, consisting of the words "Hare", "Krishna", and "Rama", is translated into numerical values: "Hare" as 1, "Krishna" as 2, and "Rama" as 3. This transformation allows for a quantitative analysis of the sequence. The cumulative sum of these numerical values is calculated and plotted to visualize the progressive accumulation of the mantra's elements. This plot highlights how the repetition and order of the words contribute to the overall pattern and progression of the chant. To further understand the sequence, a moving average analysis with a window size of three is performed. This technique smooths out short-term fluctuations, providing a clearer view of the underlying trends and potential convergence within the sequence. The resulting plots offer a comprehensive visualization of the mantra's structure, revealing insights into its repetitive patterns and overall flow, which are integral to understanding its meditative and psychological effects.

Files

Steps to reproduce

import numpy as np import matplotlib.pyplot as plt # Define the mantra sequence mantra_sequence = ["Hare", "Krishna", "Hare", "Krishna", "Krishna", "Krishna", "Hare", "Hare", "Hare", "Rama", "Hare", "Rama", "Rama", "Rama", "Hare", "Hare"] # Convert to numerical representation for analysis (Hare=1, Krishna=2, Rama=3) sequence_numeric = [1 if word == "Hare" else 2 if word == "Krishna" else 3 for word in mantra_sequence] # Calculate the cumulative sum to see the repetition pattern cumulative_sum = np.cumsum(sequence_numeric) # Plot the sequence plt.figure(figsize=(10, 6)) plt.plot(cumulative_sum, marker='o', linestyle='-', color='b') plt.title("Cumulative Sum of the Hare Krishna Mantra Sequence") plt.xlabel("Step") plt.ylabel("Cumulative Sum") plt.grid(True) plt.show() # Analyze the sequence for convergence (example: moving average) window_size = 3 moving_avg = np.convolve(sequence_numeric, np.ones(window_size)/window_size, mode='valid') # Plot the moving average plt.figure(figsize=(10, 6)) plt.plot(moving_avg, marker='x', linestyle='-', color='r') plt.title("Moving Average of the Hare Krishna Mantra Sequence") plt.xlabel("Step") plt.ylabel("Moving Average") plt.grid(True) plt.show()

Institutions

Independent

Categories

Psychology, Behavioral Psychology, Habits of Mind, Mindfulness

Licence