Posts

張禹希期末考

Image
影片 截圖 程式碼 pmt = [0,0,0,0] #張禹希程式設計586設定串列list pmt[0]=float(input('張禹希躉繳金額: '))#float轉換成實數float for nper in range(1,4):     pmt[nper] = float(input('第'+str(nper)+'期回收: ')) def npv(rate):     y = - pmt[0]     for j in range(1,4):         y = y + pmt[j]/(1+rate)**j     return y a, b, gap, f = 0.0, 1.0, 9.0, 9.0 maxerror = 0.000001 loopNumber = 1 while (gap > maxerror and abs(f) > maxerror and loopNumber < 100):     loopNumber+=1     c = (a+b)/2;     f = npv(c);     if ( abs(f) > maxerror and gap > maxerror):         if ( f>0 ):             a = c         else:            b = c         gap = b-a; print('張禹希報酬率: ', c) print('張禹希淨現值: ', f) print('張禹希迴圈次數: ', loopNumber) 心得:這學期學會網路程式語言JAVASCRIPT也學會人工智慧使用最多的PYTHON語言

python tkinter繪圖對比EXCEL

Image
def pv(r,n,m,f):#劉任昌函數參數r,n,m,f p = m/r*(1 - 1/(1+r)**n)+f/(1+r)**n return p#執行函數的結果傳回去 n=float(input('期數: '))#要計算轉為實數real nubers m=float(input('收付: '))#浮點點float f=float(input('終值: ')) for i in range(1,10):#迴圈 r = i*0.01 x=pv(r,n,m,f) print('利率 ', r ,'價格 ', x) import tkinter as tk#輸入tkinter繪圖 root = tk.Tk() root.title('張禹希python tkinter') root.geometry('600x600')#寬度width改成600 canvas = tk.Canvas(root, width=600, height=300) # 加入 Canvas 畫布 canvas.pack() x, y = 0, 0 canvas.create_line(0, 400, 500, 400, width=5,fill='blue') canvas.create_line(5, 0, 5, 400, width=5,fill='blue') for x in range(1, 400): x1 = x+1 y1 = 400 - pv(x1,n,m,f)*400 canvas.create_line(x, y, x1, y1, width=5,fill='green') canvas.pack() x = x1 y = y1 root.mainloop()

張禹希Javascript計算現值PresentValue和Python比較

Image
利率y(rate) 期數n(nper) 金流m(pmt) 終值f(fv) 參考劉任昌金融市場講義https://drive.google.com/file/d/17z6UZgN5fC2XCO1L8_BQs57dgQXzbwou/view?usp=sharing 張禹希學習HTML+CSS+JavaScript程式碼

三個Javascript函數sin,cos與canvas.font

Javascript在網頁就可以執行不需要開啟Spyder sin執行 cos執行 橫軸

張禹希Javascript執行三角函數繪圖

Image
Javascript在網頁就可以執行不需要開啟Spyder 張禹希執行

Word File Processing in Python(Python處理word檔)

Image
embed嵌入(bed床,放入床上,嵌入鑽戒) 影片重點 Let's develop brains. 作文,在捷運讓座let給老弱婦孺。 yield (投降, 收益) Yield seats to elderly YTM=Yield to Maturity=到期收益率 nominal yield=coupon rate=票面利率 利用python編輯edit建立create word 檔案 Process 處理....procedure程序 SOP python命令,給文件新增加一個段落 document.add_paragraph('文字內容',格式) 網頁javascript命令 document.create_element('P'); 維基百科Python了解 Python was conceived in the late 1980s[42] by Guido van Rossum at Centrum Wiskunde & Informatica (CWI) in the Netherlands; it was conceived as a successor to the ABC programming language, which was inspired by SETL,[43] capable of exception handling and interfacing with the Amoeba operating system.[12] Python implementation began in December 1989.[44] Van Rossum assumed sole responsibility for the project, as the lead developer, until 12 July 2018, when he announced his "permanent vacation" from responsibilities as Python's "benevolent dictator for life" (BDFL); this title was bestowed on him by the P...

張禹希Javasript網頁BUTTON按鈕ONCLICK事件call呼叫

物件導向設計OOP=Object-Oriented Programming 主詞subject受詞object東方的oriental id=identity,身分證id card, division區塊,段落 張禹希執行 函數名稱()將要執行的程式碼用curly braces圍住。 PYTHON換列就是;區隔指令。PYTHON同一個縮排,就是{}同一區塊 AVASCRIPT的字典 dict =new Map([["2303","聯電"],["2330","台積電"],["2880","華南金"],['AAPL','蘋果公司'],['C','花旗銀行'],['T','美國電話電報']]);//宣告配對(字典) PYTHON的字典 dict ={"2303":"聯電","2330":"台積電","2880":"華南金",'AAPL':'蘋果公司','C':'花旗銀行','T','美國電話電報'}