import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation, FFMpegWriter
# Define the new function to integrate: x * log(x)
def func(x):
# Avoid log(0) by returning 0 when x is 0
return np.where(x == 0, 0, x * np.log(x))
# Set up the figure and axis
fig, ax = plt.subplots()
a, b = 0.01, 2 # Define the interval [a, b] avoiding 0 to prevent log(0) issues
x_vals = np.linspace(a, b, 1000)
ax.plot(x_vals, func(x_vals), 'r', label=r'$x \log(x)$')
ax.set_ylim(-1, 2)
ax.set_xlim(a, b)
# Title and labels
ax.set_title('Numerical Integration Process using Trapezoidal Rule for $x \log(x)$')
ax.set_xlabel('x')
ax.set_ylabel('f(x)')
ax.legend()
# Fill area under the curve (for animation purposes)
patches = [] # To store the artists
# Define the number of trapezoids to draw
n_trapezoids = 50
x_points = np.linspace(a, b, n_trapezoids + 1)
y_points = func(x_points)
# Function to update the animation at each step
def update(frame):
global patches
for patch in patches:
patch.remove()
patches = []
# Plot the new trapezoid for the current frame
if frame > 0:
patch = ax.fill_between([x_points[frame-1], x_points[frame]], [y_points[frame-1], y_points[frame]],
color='lightblue', alpha=0.5)
patches.append(patch) # Store the artist
# Redraw the whole plot with current trapezoids filled
for i in range(1, frame):
patch = ax.fill_between([x_points[i-1], x_points[i]], [y_points[i-1], y_points[i]], color='lightblue', alpha=0.5)
patches.append(patch) # Store each trapezoid artist
# Create the animation
ani = FuncAnimation(fig, update, frames=range(1, n_trapezoids+1), interval=200, repeat=False)
# Save the animation as an MP4 file using FFmpeg
mp4_writer = FFMpegWriter(fps=10, metadata=dict(artist='Me'), bitrate=1800)
ani.save("integration_animation_xlogx.mp4", writer=mp4_writer)
# Optionally, show the animation (if you still want to display it)
plt.show()
R – monthly from Oct 2023 to Aug 2024
library(RSQLite)
library(DBI)
library(ggplot2)
# Define the path to your SQLite database
db_path <- "/home/jbyungrokim/CSV/CSV.db"
# Connect to the SQLite database
conn <- dbConnect(RSQLite::SQLite(), dbname = db_path)
# Define the range of months
months <- c('2023-10', '2023-11', '2023-12', '2024-01', '2024-02', '2024-03', '2024-04', '2024-05', '2024-06', '2024-07', '2024-08')
# Loop through each month and run the query
for (month in months) {
query <- paste0("
SELECT
Item,
SUM(Pay_Amount) AS Total_Spent
FROM
'지출-액수_2024_09_18'
WHERE
strftime('%Y-%m', '20' || substr(Date_Transaction, 7, 2) || '-' || substr(Date_Transaction, 1, 2) || '-' || substr(Date_Transaction, 4, 2)) = '", month, "'
GROUP BY
Item
ORDER BY
Total_Spent DESC;
")
# Execute the query and store the result in a data frame
monthly_sum <- dbGetQuery(conn, query)
# Print the result
print(paste("Sum of Pay_Amount by Item for", month, ":"))
print(monthly_sum)
# Save the result as a CSV file
csv_file_path <- paste0("/home/jbyungrokim/Downloads/지출-", month, "_sum.csv")
write.csv(monthly_sum, file = csv_file_path, row.names = FALSE)
print(paste("Data has been written to", csv_file_path))
# Create a bar graph using ggplot2
p <- ggplot(monthly_sum, aes(x = reorder(Item, -Total_Spent), y = Total_Spent)) +
geom_bar(stat = "identity", fill = "steelblue") +
theme_minimal() +
labs(title = paste("Total Spending by Item for", month),
x = "Item",
y = "Total Spent ($)") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
# Print the plot to ensure it displays
print(p)
}
# Close the connection to the SQLite database
dbDisconnect(conn)
714-761-5454
한의원 (PST). 배상석 원장. 즉시 관심 보이며 관리비가 얼마냐고 물음. 월$45 quoted. 내 전화번호 가지고 있다가 연락하겠단다 (9/20/2024).
714-512-1543 넘버로 … 진료 중 입니가. 곧 연락 드리겠습니다, 하고 텍스트 메지지 왔음 (9/23/2024).
원장 왈, 전화 번호 저장해 놓았고요, 필요하면 연락 드릴께요, 함. 전화 올 때까지 한 동안 전화 안 하는 것이 좋을 듯 (9/24/2024).
Plugins – Updates managed by WordPress.com
Akismet Anti-spam: Spam Protection
Classic Editor
Crowdsignal Forms
Crowdsignal Polls & Ratings
Gutenberg
Jetpack
Layout Grid
Page Optimize
WordPress.com Editing Toolkit