發表文章

黎冠妤Python執行IRR

圖片
嵌入黎冠妤解說影片 嵌入WIKIPEDIA二分法 pmt = [0,0,0,0] #黎冠妤程式設計586設定串列list pmt[0]=float(input('躉繳金額: ')) 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計算內部報酬IRR

圖片
躉繳 第1期 第2期 第3期 注意,包含首期躉繳的現金流量都大於0。 輸出: 報酬率: 淨現值: 迴圈次數: 黎冠妤向項柏綱學習程式設計程式碼如下 <head> <style> h1 {   margin: 0;   padding: 20px 0;       color: #000000;   text-shadow: 5px 5px 2px yellow; } .Takming {   border: 20px outset red;   background-color: green;   color: white;   text-align: center;} .pmt {   width: 60pt;   height: 20pt;   background-color: coral;   color: white;   text-align: right;} </style> </head> <body> <table border="1"> <tr align="center"><td>躉繳</td><td>第1期</td><td>第2期</td><td>第3期</td></tr> <tr><td><input class="pmt" type="number" /></td>    <td><input class="pmt" type="number" /></td>    <td><input class="pmt" type="number" /></td>    <td><input class="pmt" type="number" /...

黎冠妤python自訂函數EXCEL PV和繪圖

圖片
python tkinter create_line利用tkinter繪圖 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('600x300')#寬度width改成600 canvas = tk.Canvas(root, width=600, height=300) # 加入 Canvas 畫布 canvas.pack() x, y = 0, 0 canvas.create_line(0, 200, 500, 200, width=3,fill='black') for x in range(1, 200): x1 = x+1 y1 = 200 - pv(x1,n,m,f)*200 canvas.create_line(x, y, x1, y1, width=5,fill='blue') canvas.pack() x = x1 y = y1 root.mainloop()

第15週金融計算與WORD方程式

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

Javascript的輸出字體.font與fillStyle與fillText 5月 26, 2025

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

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

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

黎冠妤Javascript三角函數

執行

python三角函數youtube影片

圖片
程式碼 from tkinter import * #或者import tkinter as tk import math tk = Tk() #建構視窗名為tk tk.geometry('1200x400') tk.title("黎冠妤python tkinter三角函數") canvas = Canvas(tk, width=1200, height=400, bg='gray') canvas.grid(row=0,column=0,padx=5,pady=5,columnspan=3) delay=20 # milliseconds, 1/1000秒 x1,y1,z1=0,200,10 h=190 #上下範圍 degree=0 #角度degree def LauHou(): global x1, y1,z1 x2 = x1 + 1 y2=200 - h*math.sin(0.02*x2) z2=200 - h*math.cos(0.02*x2) l1=canvas.create_line(x1,y1,x2,y2,fill='red',width=5) l2=canvas.create_line(x1,z1,x2,z2,fill='yellow',width=5) if (x2

Javascript建構網頁文件vs.Python建構word文件

現在 瀏覽器 建構網頁,然後在Spyder輸入docx函式庫,建構WORD文件。拷貝以下紅色框內的程式碼到記事本,另存檔名「自己名字.HTML」,存檔類型必須「*.*」。 <P id='shit'> 網頁和微軟WORD相同的命令document.paragraph</P> </body> <script> let t = document.createElement("H1"); t.innerText = "標題一"; t.style.background ='yellow'; document.body.appendChild(t); let u = document.createElement("P"); u.innerText = "創立create元素Element。"; u.style.background ='green'; document.body.appendChild(u); let v = document.createElement("SPAN"); v.innerText = "小段SPAN相當於WORD的run。"; v.style.background ='blue'; document.getElementById('shit').appendChild(v); </script>

黎冠妤html 按鈕button事件onclick

物件導向設計OOP=Object-Oriented Programming 主詞subject受詞object東方的oriental id=identity,身分證id card, division區塊,段落 class Stock{ //宣告類別 constructor(code, shares, price){//建構子constructor this.code = code; this.shares = shares; this.price = price;} } s1 = new Stock("2330", 100, 1000); //建構子Stock建構s1 s2 = new Stock("2880", 1000, 30); //建構子Stock建構s2 s3 = new Stock("C", 100, 1000); //建構子Stock建構s1 s4 = new Stock("T", 1000, 30); //建構子Stock建構s2 st = s1.code+' 股數 '+s1.shares.toString()+' '+s2.code.toString()+' 股數 '+s2.shares; document.getElementById('cat').innerHTML = st; st = dict.get(s3.code)+' 股數 '+s3.shares.toString()+' '+dict.get(s4.code)+' 股數 '+s4.shares; document.getElementById('dog').innerHTML = st; 黎冠妤 期中考心得 JAVASCRIPT的字典 dict =new Map([["2303","聯電"],["2330","台積電"],["2880","華南金"],['AAPL','蘋果公司...

黎冠妤JavaScript的物件導向Python的物件導向

圖片
物件導向程式設計 Javascript指令new Constructor產生新的instance案例 s1.shares.toString()=案例sa的屬性shares內建方法toString()轉成字串,原來的數字被轉成字串string才可以和其他字串相加 在原來的輸出指令插入dict.get(s1.code)+從字典dict查詢s1.code Javascript程式碼 <DVI ID='cat ></DVI> <SCRIPT> class Stock{ //宣告類別 constructor(code, shares, price){ this.code = code; this.shares = shares; this.price = price;} } s1 = new Stock("2330", 100, 1000); //建構子Stock建構s1 s2 = new Stock("2880", 1000, 30); //建構子Stock建構s2 st = s1.code+' 股數 '+s1.shares.toString()+' '+s2.code.toString()+' 股數 '+s2.shares; document.getElementById('cat').innerHTML = st; Javascript程式碼加入配對(字典)指令 dict =new Map([["2303","聯電"],["2330","台積電"],["2880","華南金"]]);//宣告配對(字典) w3schools練習

黎冠妤Javascript與Python比較

黎冠妤增加 黎冠妤銀行 刪除串列的最後一個元素

黎冠妤整合開發環境的jubyter編輯python程式碼

圖片
SPYDER程式碼 程式碼 from tkinter import * #從函式庫 tkinter 輸入所有 * 方法 banks=['摩根大通','美國銀行','中國工商','富國銀行','匯豐銀行','巴黎銀行'] def ABC(): #畫圖 define自訂函數 global b1 txt = '' for i in range(len(banks)): txt += banks[i] + ' ' b1=Label(canvas,text=txt,font='Arial 20 bold') b1.pack(side=TOP) def XYZ(): #清除視窗的all所有canvas圖 banks.append('三菱銀行') banks.append('000銀行') ABC()#結束XYZ之前給它顯示 def kill(): b1.pack_forget() tk = Tk() tk.title("黎冠妤python建立tkinter視窗使用者介面") #也可以定義視窗名為 window, root課本都如此習慣 canvas = Canvas(tk, width=400, height=400) canvas.pack() btn1 = Button(tk, text="顯示銀行", command = ABC, bg='black',fg='white').pack(side=LEFT) btn2 = Button(tk, text="000增加", command = XYZ).pack(side=LEFT) btn3 = Button(tk, text="000刪除", command = kill).pack(side=LEFT) tk.mainloop()

黎冠妤Javascript與Python比較

全球市場價值最大的銀行 按鈕push增加 pop刪除最後一項 按鈕pop執行kill呼叫其他函數 CSS也可以in-line 以上javascript與html與css程式碼

黎冠妤python串列List(陣列Array),元組Tuple,集合Set,字典Dict

圖片
EMBED嵌入影片522 期中考試重點 .SELECTOR{用在多個元素} UL=UNDERER LIST, OL=ORDERED LIST, LI=LIST 大括號{ } CURLY BRACKET, CURLY捲,用於PYTHON的集合 中括號[ ] SQUARE BRACKET, SQUARE方形,用於PYTHON串列 小括號( )CIRCLE BRACKER, CIRCLE圓,用於 PYTHON元組 角括號<>CORNER BRACKET 圓周CIRCUMFERENCE,直徑DIAMETER, 半徑RADIUS BORDER邊界, SOLID實心, PX=PIXEL點,

2025年3月4日上課Python陣列array串列的函數(方法)

利用w3schools練習的python指令 animal = ["豬", "牛", "羊", '貓'] #python語言的註解comments x = animal.copy() print(animal) x.reverse() #將x反轉reverse print(x) animal.append('狗') print(animal) y = animal.copy() y.reverse() #將x反轉reverse print(y)

乙班0225黎冠妤利用chatgpt大語言模型產出程式碼

圖片
黎冠妤Canvas 計算機 黎冠妤Canvas 計算機 Python陣列方法 Method Description append() Adds an element at the end of the list clear() Removes all the elements from the list copy() Returns a copy of the list count() Returns the number of elements with the specified value extend() Add the elements of a list (or any iterable), to the end of the current list index() Returns the index of the first element with the specified value insert() Adds an element at the specified position pop() Removes the element at the specified position remove() Removes the first item with the specified value reverse() Reverses the order of the list sort() Sorts the list Python陣列方法在撰寫模式貼上 a Method Description append() Adds an element at the end of the list clear() Removes all the elements from the list copy() Returns a copy of the list count() Returns the number of elements with the specified value extend() Add the elements of a list (or any iterable), to the end of the current list index() Returns the ind...

乙班黎冠妤期末考Math.PI與Math.E放入計算機

黎冠妤學習Bro code製作計算機 + 7 8 9 - 4 5 6 x 1 2 3 ÷ 0 . = C π e ** https://www.youtube.com/watch?v=I5kj-YsmWjM Build this JS calculator in 15 minutes!

已搬黎冠妤eval函數將數字串運算

黎冠妤學習Bro code製作計算機 display.value = eval(display.value) display的vlue用eval(display.value)取代,算是「字串」運算結果 eval()內建函數(方法) in-line線內設定樣式。readonly唯讀read only。電腦的.的接續術性或函數disply.value面板顯示的內容value值。px=pixel點 + 7 8 9 - 4 5 6 * 1 2 3 / 0 . = 刪 黎 冠 妤 https://www.youtube.com/watch?v=I5kj-YsmWjM Build this JS calculator in 15 minutes!

乙班下午黎冠妤學習Bro Code計算機

圖片
黎冠妤學習Bro code製作計算機 + 7 8 9 - 4 5 6 * 1 2 3 ÷ 0 . = C 黎 冠 妤 https://www.youtube.com/watch?v=I5kj-YsmWjM Build this JS calculator in 15 minutes! 心得與考試重點 10進為字碼表達÷÷ 247=16*15+7=16*F+7= 字碼CODE 48 60 61 62 65 97 247 字元CHARACTER 0 < = > A a ÷ 48:0, 60<,60=48+12=16*3+C, < 61:=, 62:>, 65:A, 97:a, 247:÷, 如果用16進位前面要加上小寫的X hover翱翔 Active