This document appears to be lecture notes on investments and financial markets. It includes discussions of topics like modern portfolio theory, beta, technical analysis, bubbles, gambling strategies like martingale and Kelly criterion. It provides examples to illustrate concepts like joint probability distributions and optimal fractional betting strategies. Graphs and formulas are presented. Feedback is requested at the end.
This document discusses using Python to analyze LHC data from CERN's Higgs Boson machine learning challenge on Kaggle. It introduces ROOT and TMVA tools for working with particle physics data in C++ and Python. It also discusses SciPy and Scikit-Learn libraries that can be used for tasks like data preprocessing, machine learning algorithms, and visualization.
This document provides an overview of macros and VBA in Excel. It discusses how Excel objects like workbooks, worksheets and cells can be automated using VBA macros. Macros allow repetitive tasks to be standardized and errors to be reduced. The document demonstrates how to record, write, run and debug VBA macros. It also covers topics like loops, variables, userforms and hiding/showing sheets dynamically with macros. Best practices discussed include using message boxes for debugging, avoiding select statements, and proper use of quotes and sheet references.
In many occasions, Innovation arise in silence and non-doing. And the way mindfulness is applied in medicine, health care, education, business is a process of innovation and creativity.
Dokumen tersebut memberikan penjelasan mengenai Excel VBA Macro, mulai dari pengenalan makro, cara membuat makro, menggunakan Excel Macro Recorder, dasar-dasar VBA seperti variabel, pernyataan if-then, looping, objek workbook dan worksheet, hingga pembuatan kontrol seperti textbox, listbox, checkbox, dan userform.
This document appears to be lecture notes on investments and financial markets. It includes discussions of topics like modern portfolio theory, beta, technical analysis, bubbles, gambling strategies like martingale and Kelly criterion. It provides examples to illustrate concepts like joint probability distributions and optimal fractional betting strategies. Graphs and formulas are presented. Feedback is requested at the end.
This document discusses using Python to analyze LHC data from CERN's Higgs Boson machine learning challenge on Kaggle. It introduces ROOT and TMVA tools for working with particle physics data in C++ and Python. It also discusses SciPy and Scikit-Learn libraries that can be used for tasks like data preprocessing, machine learning algorithms, and visualization.
This document provides an overview of macros and VBA in Excel. It discusses how Excel objects like workbooks, worksheets and cells can be automated using VBA macros. Macros allow repetitive tasks to be standardized and errors to be reduced. The document demonstrates how to record, write, run and debug VBA macros. It also covers topics like loops, variables, userforms and hiding/showing sheets dynamically with macros. Best practices discussed include using message boxes for debugging, avoiding select statements, and proper use of quotes and sheet references.
In many occasions, Innovation arise in silence and non-doing. And the way mindfulness is applied in medicine, health care, education, business is a process of innovation and creativity.
Dokumen tersebut memberikan penjelasan mengenai Excel VBA Macro, mulai dari pengenalan makro, cara membuat makro, menggunakan Excel Macro Recorder, dasar-dasar VBA seperti variabel, pernyataan if-then, looping, objek workbook dan worksheet, hingga pembuatan kontrol seperti textbox, listbox, checkbox, dan userform.
13. 使用陣列的注意事項使用陣列的注意事項 (2)(2)
不能 一次讀取或指定整個陣夠不能 一次讀取或指定整個陣夠
列的資料,例如:列的資料,例如:
Dim Y(10) As Integer
Y = 100 ' 想把整個陣列的資料指定為 100 ,不接受
For I = 0 To 10
Y(I) = 100 ' 逐一對每一個陣列元素進行指定動作才是正確的
Next I
17. 陣列的優點陣列的優點 (3)(3)
如果我們把這如果我們把這 55 項資料放在陣列裡面,則只項資料放在陣列裡面,則只
需三行敘述就可以把它們全部印出來,如下:需三行敘述就可以把它們全部印出來,如下:
而即使資料的項數多達而即使資料的項數多達 100100 項,也只要將上述項,也只要將上述
程式程式 ForFor 敘述中的敘述中的 44 改成改成 9999 ,就可以把資料,就可以把資料
全部印出來,如果換成列印全部印出來,如果換成列印 100100 個變數可就累個變數可就累
了。了。
For I = 0 To 4
Print X(I)
Next I
18. 陣列的優點陣列的優點 ---- 實例練習一實例練習一
輸入輸入 55 份資料,然後將資料顛倒順序列份資料,然後將資料顛倒順序列
印出來。印出來。
Dim X(4)
For I = 0 To 4
X(I) = InputBox(" 請輸入第 " & I & " 份資
料 ")
Next
For I = 4 To 0 Step -1
Print " 請輸入第 " & I & " 份資料 = "; X(I)
Next
19. 陣列的優點陣列的優點 ---- 實例練習二實例練習二
輸入輸入 55 份數值資料,輸入完畢之後,將份數值資料,輸入完畢之後,將
最大值及最小值顯示出來。最大值及最小值顯示出來。
Dim X(4)
For I = 0 To 4
X(I) = Val(InputBox(" 請輸入第 " & I & " 份資料 "))
Next
Min = X(0) ' 先假設第 0 份資料為最小值
Max = X(0) ' 先假設第 0 份資料為最大值
For I = 1 To 4 ' 然後從第 1 份資料開始比較
If X(I) < Min Then Min = X(I)
If X(I) > Max Then Max = X(I)
Next
Print " 最大值 = ";Max, " 最小值 = ";Min
24. 註標範圍讀取註標範圍讀取 ---- 實際應用實際應用
LboundLbound 與與 UboundUbound 若應用在程式中,可增加程式的彈性若應用在程式中,可增加程式的彈性
,舉例來說,前面有一段列印陣列所有資料的程式,如下,舉例來說,前面有一段列印陣列所有資料的程式,如下
::
這個程式的缺點是:當我們修改陣列這個程式的缺點是:當我們修改陣列 XX 的註標範圍時的註標範圍時
,必須跟著修改,必須跟著修改 ForFor 敘述中的敘述中的 00 及及 44 。如果把它改成。如果把它改成
::
For I = 0 To 4
Print X(I)
Next I
For I = LBound(X) To UBound(X)
Print X(I)
Next I
30. 可改變大小陣列可改變大小陣列 ---- 保留陣列元素的值保留陣列元素的值
(1)(1)
請注意利用請注意利用 ReDimReDim 調整大小的陣列,原調整大小的陣列,原
陣列中的所有資料都會被清成陣列中的所有資料都會被清成 00 或空值或空值
,如果想保留原陣列中的資料,則要在,如果想保留原陣列中的資料,則要在
ReDimReDim 之後加上之後加上 PreservePreserve 保留字,格式保留字,格式
是:是:ReDi m Pr eser ve 陣列名稱 ( M To N)
表示保留原陣列中的資料
31. 可改變大小陣列可改變大小陣列 ---- 保留陣列元素的值保留陣列元素的值 (2)(2)
請參考以下例子:請參考以下例子:
ReDim X(5)
ReDim Y(10) As Integer
For I = 0 To 5
X(I) = “computer” & I
Next I
For I = 0 To 10
Y(I) = I*10
Next I
ReDim X(10) ‘ 把陣列 X 加大,但未加 Preserve ,
所以
’ 原陣列 X(0) ~ X(5) 的資料都會被清
掉
ReDim Preserve Y(7) ‘ 將陣列 Y 縮小,但加了
Preserve ,所以
33. 可改變大小陣列可改變大小陣列 ---- 實例練習實例練習
(2)(2)
Dim X() ’ 先宣告一個陣列元素個數等於 0 的陣
列
N = 0 ’ 用變數 N 來記錄使用者輸入的筆數
data = InputBox(“ 請輸入資料” )
While data <> “quit” ’ 若輸入≠“ quit” ,持續輸入
ReDim Preserve X(N+1) ’ 將陣列 X 加大 1 筆
X(N) = data ' 將輸入的資料指定到陣列的最後一個
元素
N = N + 1 ’ 增加了一筆
34. 可改變大小陣列可改變大小陣列 ---- 實例練習實例練習
(3)(3)
輸入結束後,如果 想檢 陣列的內容您 查輸入結束後,如果 想檢 陣列的內容您 查
是否正確,可利用以下迴圈將資料輸出是否正確,可利用以下迴圈將資料輸出
到表單上:到表單上:
For I = 0 To N - 1
Print X(I), ' 尾巴加個逗號,表示不要跳
行
If (I+1) MOD 4 = 0 Then Print ' 每 4
筆跳一行
Next I
38. 二維陣列資料的輸入二維陣列資料的輸入 (1)(1)
如果要對整個二維陣列的資料進行處理,通常要使用如果要對整個二維陣列的資料進行處理,通常要使用
For-NextFor-Next 巢狀迴圈,例如利用巢狀迴圈,例如利用 InputBoxInputBox 輸入資料到以輸入資料到以
上二維陣列的程式,如下圖。上二維陣列的程式,如下圖。
請注意在請注意在程式程式 -1-1 之中,我們以「列」為外迴圈,所以之中,我們以「列」為外迴圈,所以
外迴圈每執行一次,便存入一橫列。外迴圈每執行一次,便存入一橫列。
Di m X( 4, 3)
For I = 0 To 4 列
For J = 0 To 3 行
S = "請輸入資料( " & I & " , " & J & " ) "
X( I , J) = I nput Box( S )
Next J
Next I
陣列資料
存入順序
1
2
3
4
5
外迴圈執行一次
便存入一橫列
程式-1
41. 二維陣列的實例研究二維陣列的實例研究 (2)(2)
Dim Score(4, 9)
For I = 0 To 4
Sum = 0
For J = 0 To 9
S = " 輸入第 " & I + 1 & " 位歌者 , 第 " & J + 1 & " 位評審的分
數 "
Score(I, J) = Val(InputBox(S))
Sum = Sum + Score(I, J)
Next J
Print " 第 "; I + 1; " 位歌者總分 ="; Sum, " 平均分數 ="; Sum /
10
Next I
62. 控制元件陣列控制元件陣列 ---- 實例練習實例練習
Step2Step2
在表單上佈置一命令鈕,並且撰寫以下在表單上佈置一命令鈕,並且撰寫以下
程式:程式:
Dim Index As Integer ' 此一變數的宣告須撰寫在程式區塊
之外
Private Sub Command1_Click()
Set Form1.Picture = Image1(Index).Picture
Index = Index + 1
If Index > 2 Then Index = 0
End Sub
69. TimerTimer 控制元件控制元件 ---- 實例實例 (2)(2)
2.2. 雙按表單上的雙按表單上的 TimerTimer ,然後在,然後在
Timer1_TimerTimer1_Timer 程式區塊中撰寫以下程式程式區塊中撰寫以下程式
::
Private Sub Timer1_Timer()
Print ".";
End Sub
70. TimerTimer 控制元件控制元件 ---- 實例實例 (3)(3)
在以上例子中在以上例子中 ,, 我們可以把計時器的工作原理我們可以把計時器的工作原理
表示成下圖:表示成下圖:
1 秒
Pr i vat e Sub Ti mer 1_Ti mer ( )
Pr i nt ". " ;
End Sub
時間間隔設定
驅
動