Thursday, January 26, 2023

Adam Smith's grave in Canongate Kirkyard on the Royal Mile, Edinburgh, S...

 


Adam Smith's grave in Canongate Kirkyard on the Royal Mile, Edinburgh, Scotland, UK. Whenever I visit Edinburgh, I give Adam Smith, the father of economics, a prayer.

 This newly started YouTube channel exhibits various short videos of Scotland.

Please visit to watch! Cheers!

 

 


 

Tuesday, January 17, 2023

Python Experiment: Macroeconomic Theory: Income Price Inflation Control Simulator in the ADAS model


 I have created a macroeconomic policy simulator with Python programming. 

This refers to the aggregate demand and supply interaction based on the simplified IS-LM interaction influencing the aggregate demand (AD) and the labour market and the capital cost influencing the short-run aggregate supply (AS). These curves are composed of the two main parameters, the aggregate income level and the price level, as well as the money supply (MS) basing the IS-LM, and the wage index (W) basing the labour market. 

My Python codes are as follows: 

# Default Parameters
import random
Y=[20,30]  # The aggregate income level: Change here to see each effect
P=[100,102] # The price level: Change here to see each effect
W=[10]
WB=0.2
MS=[100]
rHD=10 
CapCost=[10]

# Function representing the price inflation
def PrInf():
    return ((P[-1]-P[-2])/P[-2])

PrInf()

# Higher function
# The aggregate demand influence
def Y_Inv(MSlmis,Ylmis,dp):
    r_MS=pow(MSlmis/10,-1.05)+rHD*(PrInf()) #LM side
    return pow(Ylmis,-1*(r_MS-PrInf())) #IS-side

Y_Inv(MS[-1],Y[-1],PrInf())

# A part of the short-run aggregate supply influence (The Labour Market).
def Y_Lab(Wlab,Plab):
    return (50-(50/(Wlab/Plab)))/100

Y_Lab(W[-1],1+PrInf()+0.000001)


def AggregateDemandCurve(Ydd):
    Pd=Y_Inv(MS,Ydd)/Ydd
    return Pd

def AggregateSupplyCurve(Wlab,Plab,Css):
    Ps=Css+Y_Lab(Wlab,Plab)
    return Ps
    

def AggregateSupplyCurveShift(Y1,Y2,Pinv):
    dp=(Y_Inv(MS[-1],Y1,Pinv))-(Y_Inv(MS[-1],Y2,Pinv)) #AggregateDemandCurve(Yd1)-AggregateDemandCurve(Yd2)
    return dp

print(Y_Inv(MS[-1],Y[-1],PrInf()),Y[-1],PrInf())
print(Y_Inv(MS[-1],Y[-2],PrInf()),Y[-2],PrInf())
AggregateSupplyCurveShift(Y[-1],Y[-2],PrInf())


def AggregateDemandCurveShift(Y1,Y2,Wlab,Plab,Csd):
    dp = (Csd+(Y_Lab(Wlab,Plab)*(1+WB*(Y1-Y2)/Y2)))-(Csd+Y_Lab(Wlab,Plab)) #AggregateSupplyCurve(Yd1)-AggregateSupplyCurve(Yd2)
    return dp

print(CapCost[-1]+(Y_Lab(W[-1],PrInf())*(1+WB*(Y[-1]-Y[-2])/Y[-2])))
print(CapCost[-1]+Y_Lab(W[-1],PrInf()))
           
AggregateDemandCurveShift(Y[-1],Y[-2],W[-1],PrInf(),CapCost[-1])

# Calculating the average aggregate income level across all over the time period to generate the long-run aggregate supply interaction
def Ymean():
    Ysum=0
    for i in range(len(Y)):
        Ysum=Ysum+Y[i]
    return Ysum/len(Y)
Ymean()

# Main function: The interaction of the aggregate demand and the short-run aggregate supply
def Shift1(MSlmis=MS,Y1=Y[-1],Y2=Y[-2],Wlab=W,Plab=PrInf(),Csd=CapCost[-1],Pinv=PrInf()):
    OutputGap=Y[-1]-Ymean()
    PriceInflation=((P[-1]-P[-2])/P[-2])
    if (OutputGap>0.05) & (PriceInflation>0.0001): # Positive Inflation
        dP=AggregateDemandCurveShift(Y1,Y2,Wlab,Plab,Csd)
        P.append(P[-1]*(1+dP))
        print(dP)
        MS.append(MS[-1]*(1+OutputGap/Ymean()))
        print(MS[-1])
        Y.append(Y[-1]*(1+(Y_Inv(MS[-1],Y[-1],dP)-Y_Inv(MS[-2],Y[-1],PriceInflation))))
        W.append(W[-1])
        CapCost.append(CapCost[-1])
    elif (OutputGap<-0.05) & (PriceInflation>0.0001): # Negative Inflation
        dP=AggregateSupplyCurveShift(Y1,Y2,Pinv)
        P.append(P[-1]*(1+dP))
        print(dP)
        W.append(W[-1]*(1+Ymean()/OutputGap))
        CapCost.append((1+dP)*CapCost[-1])
        print(W[-1])
        Y.append(Y[-1]*(CapCost[-1]/CapCost[-2]+(Y_Lab(W[-1],dP)-Y_Lab(W[-2],PriceInflation))))
        MS.append(MS[-1])
    elif (OutputGap<-0.05) & (PriceInflation<-0.0001): # Deflation
        dP=AggregateDemandCurveShift(Y1,Y2,Wlab,Plab,Csd)
        P.append(P[-1]*(1+dP))
        print(dP)
        MS.append(MS[-1]*(1+OutputGap/Ymean()))
        print(MS[-1])
        Y.append(Y[-1]*(1+(Y_Inv(MS[-1],Y[-1],dP)-Y_Inv(MS[-2],Y[-1],PriceInflation))))
        W.append(W[-1])
        CapCost.append(CapCost[-1])
    elif (OutputGap<-0.05) & (PriceInflation<-0.0001): # Dereguation
        dP=AggregateSupplyCurveShift(Y1,Y2,Pinv)
        P.append(P[-1]*(1+dP))
        print(dP)
        W.append(W[-1]*(1+Ymean()/OutputGap))
        CapCost.append((1+dP)*CapCost[-1])
        print(W[-1])
        Y.append(Y[-1]*(CapCost[-1]/CapCost[-2]+(Y_Lab(W[-1],dP)-Y_Lab(W[-2],PriceInflation))))
        MS.append(MS[-1])
    else: 
        print("Nothing")
    
    print(OutputGap,P,Y)

  # See the result
Shift1(MS[-1],Y[-1],Y[-2],W[-1],PrInf(),CapCost[-1])

print(Y)
print(P)
print(MS)
print(W)
print(CapCost)

 

 

 

Saturday, January 07, 2023

Liberty s Daughter 育成ゲーム Jupyter Notebook

This is the game demo play of my game created with Python. See the detail including the codes in my blog post: Started creating in Python

Liberty s Daughter 育成ゲーム Jupyter Notebook — (1) 10 years old

 

Liberty s Daughter 育成ゲーム Jupyter Notebook — (2) 11 years old


Liberty s Daughter 育成ゲーム Jupyter Notebook — (3) 12 years old


Liberty s Daughter 育成ゲーム Jupyter Notebook — (4) 13 years old


Liberty s Daughter 育成ゲーム Jupyter Notebook — (5) 14 years old

 

Liberty s Daughter 育成ゲーム Jupyter Notebook — (6) 15 years old


Liberty s Daughter 育成ゲーム Jupyter Notebook — (7) 16 years old


Liberty s Daughter 育成ゲーム Jupyter Notebook — (8) 17 YO - 18 YO Ending (Noble Lady Ending)

 

Liberty s Daughter 育成ゲーム Jupyter Notebook — (9) 18 YO - Ending (Revolutionary Ending)

Liberty s Daughter 育成ゲーム Jupyter Notebook — (10) The Other Endings and the Python codes

For the Python codes and the furthermore details, please refer to Started creating in Python.




PS

How to play "Liberty's Daughter 育成ゲーム" with Colaboratory


Tuesday, January 03, 2023

Liberty s Daughter Jupyter Notebook — Demo Test Play

This is just a system testing phase so that some parameters are still not yet balanced. 

After playing myself for a first round, I will take videos of playing it again after tuning these parameters affecting her status. 

 

Liberty s Daughter Jupyter Notebook — Demo Test Play (1) 10 years old

 

This is my first Python game as well as my first YouTube post. This demo play is just for my own test play after completing the coding. https://art-blue-liberalism.blogspot.com/2022/12/started-creating-in-python.html

 

Liberty s Daughter Jupyter Notebook — Demo Test Play (2) 11 years old

 

Continuing from the previous video for the demo test play


Liberty s Daughter Jupyter Notebook — Demo Test Play (3) 12 years old

 

Continued. More vacation scenes displayed here.

 

 Liberty s Daughter Jupyter Notebook — Demo Test Play (4) 13 years old

 

 At the end of this video. She turns to be 14 years old so that the picture changes!

 

 Liberty s Daughter Jupyter Notebook — Demo Test Play (5) 14 years old

Continued. It gets into the new stage! The picture now is for the grown up version!


 Liberty s Daughter Jupyter Notebook — Demo Test Play (6) 15 years old

 

 Continued.

 Liberty s Daughter Jupyter Notebook — Demo Test Play (7) 16 years old


 Continued. Trying a new job with some risk. Also, being more strict at this time.

 Liberty s Daughter Jupyter Notebook — Demo Test Play (8) 17 years old

 

 Liberty s Daughter Jupyter Notebook — Demo Test Play (9) 18 years old - Ending


When she turns to be 18 years old. It is an ending. This test demo shows the ending with the best status combination. The test play is done. It is time to change some parameters to balance the game balance.

Liberty s Daughter Jupyter Notebook — Demo Test Play (10) The Other Endings and the Python codes


 Showing the other endings and the Python codes display. 

 

Opening Text (Please click below to zoom)


 Please read the detail in https://art-blue-liberalism.blogspot.com/2022/12/started-creating-in-python.html 


PS
How to play "Liberty's Daughter 育成ゲーム" with Colaboratory