Maple’s Evaluation Rules 教授 : 蔡桂宏 博士 學生 : 林佳慧 學號 :95356062 95503 統資軟體課程講義.

Slides:



Advertisements
Similar presentations
Chapter 10 馬可夫鏈 緒言 如果讀者仔細觀察日常生活中所發生的 諸多事件,必然會發現有些事件的未來 發展或演變與該事件現階段的狀況全然 無關,這種事件稱為獨立試行過程 (process of independent trials) ;而另一些 事件則會受到該事件現階段的狀況影響。
Advertisements

第三講 Recode、missing value、假設檢定與信賴區間
: Arrange the Numbers ★★★☆☆ 題組: Contest Archive with Online Judge 題號: 11481: Arrange the Numbers 解題者:李重儀 解題日期: 2008 年 9 月 13 日 題意: 將數列 {1,2,3, …,N}
布林代數的應用--- 全及項(最小項)和全或項(最大項)展開式
Introduction to Java Programming Lecture 13 Classes I OO Programming.
:Word Morphing ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10508:word morphing 解題者:楊家豪 解題日期: 2006 年 5 月 21 日 題意: 第一行給你兩個正整數, 第一個代表下面會出現幾個字串,
Reference, primitive, call by XXX 必也正名乎 誌謝 : 部份文字取於前輩 TAHO 的文章.
指導教授:陳淑媛 學生:李宗叡 李卿輔.  利用下列三種方法 (Edge Detection 、 Local Binary Pattern 、 Structured Local Edge Pattern) 來判斷是否為場景變換,以方便使用者來 找出所要的片段。
:New Land ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11871: New Land 解題者:施博修 解題日期: 2011 年 6 月 8 日 題意:國王有一個懶兒子,為了勞動兒子,他想了一個 辦法,令他在某天早上開始走路,直到太陽下山前,靠.
: OPENING DOORS ? 題組: Problem Set Archive with Online Judge 題號: 10606: OPENING DOORS 解題者:侯沛彣 解題日期: 2006 年 6 月 11 日 題意: - 某間學校有 N 個學生,每個學生都有自己的衣物櫃.
第一章 變數、常數及資料型態. 變數 C 程式語言的變數名稱 第一個字必須是英文字母或底線 (_) 之後可以是數字, 英文字母或底線 (_) 不可以是保留字 例: Num (Ο) _score (Ο) C&C (X) 8num (X)
: ShellSort ★★☆☆☆ 題組: Problem D 題號: 10152: ShellSort 解題者:林一帆 解題日期: 2006 年 4 月 10 日 題意:烏龜王國的烏龜總是一隻一隻疊在一起。唯一改變烏龜位置 的方法為:一隻烏龜爬出他原來的位置,然後往上爬到最上方。給 你一堆烏龜原來排列的順序,以及我們想要的烏龜的排列順序,你.
STAT0_sampling Random Sampling  母體: Finite population & Infinity population  由一大小為 N 的有限母體中抽出一樣本數為 n 的樣 本,若每一樣本被抽出的機率是一樣的,這樣本稱 為隨機樣本 (random sample)
1. 假設以下的敘述為一未提供 “ 捷徑計算 ” 能力的程式段,試用程 式設計的技巧,使此敘述經此改 寫的動作後,具有與 “ 捷徑計算 ” 之 處理方法相同之處理模式。 if and then E1 else E2 endif.
第三章 變數與繫結 陳維魁 博士 儒林圖書公司. 2 大綱  變數的定義  變數元件  儲存區配置問題  參考的透明性  完全計算  捷徑計算  繫結 (binding)  繫結時間  精選習題.
1 網路同步學習 如何使用中山大學管理學院知識管理平台 愷中 製作. 2 如何登入中山大學網路學習平台 1. 首先, 請輸入 2. 點選申請帳號, 依照螢幕所示, 輸入個人資訊.
南投縣社區大學 Excel 實務應用入門 講師 : 林泉成
第 7 章 程序與函數 7-1 模組化程式設計 7-1 模組化程式設計 7-2 VB.NET 的程序與函數 7-2 VB.NET 的程序與函數 7-3 程序與函數的變數範圍 7-3 程序與函數的變數範圍 7-4 VB.NET 常用的內建函數 7-4 VB.NET 常用的內建函數 7-5 遞迴函數 7-5.
Introduction to Java Programming Lecture 5: Using Java Classes : String & Math Spring 2009.
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
Introduction to Java Programming Lecture 17 Abstract Classes & Interfaces.
:Problem D: Bit-wise Sequence ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 10232: Problem D: Bit-wise Sequence 解題者:李濟宇 解題日期: 2006 年 4 月 16.
24-6 設定開始與結束場景中的 程式 最後我們要替這個遊戲收個尾, 幫它把開始 的等待畫面跟結束畫面處理一下。
: The largest Clique ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11324: The largest Clique 解題者:李重儀 解題日期: 2008 年 11 月 24 日 題意: 簡單來說,給你一個 directed.
最新計算機概論 第 5 章 系統程式. 5-1 系統程式的類型 作業系統 (OS) : 介於電腦硬體與 應用軟體之間的 程式,除了提供 執行應用軟體的 環境,還負責分 配系統資源。
: Tight words ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: : Tight Words 解題者:鐘緯駿、林一帆 解題日期: 2006 年 03 月 14 日 題意: 給定數字 k 與 n (0 ≦ k.
: War on Weather ★★☆☆☆ 題組: Contest Volumes Archive with Online Judge 題號: 10915: War on Weather 解題者:陳明凱 題意:題目總共會給你 k 個點座標代表殺手衛星的位置, 距離地球表面最少 50 公里以上,並且會給你.
: Happy Number ★ ? 題組: Problem Set Archive with Online Judge 題號: 10591: Happy Number 解題者:陳瀅文 解題日期: 2006 年 6 月 6 日 題意:判斷一個正整數 N 是否為 Happy Number.
: Fast and Easy Data Compressor ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10043: Fast and Easy Data Compressor 解題者:葉貫中 解題日期: 2007 年 3.
Y >_< I Y 一,一一,一 I Maple's Control Statements 教授:蔡桂宏 博士 學生:張杰楷 統資軟體課程講義95503 統資軟體課程講義.
: Little Red Riding Hood ★★★☆☆ 題組: Contest Volumes Archive with Online Judge 題號: 11067: Little Red Riding Hood 解題者:陳明凱 解題日期: 2008 年 3 月 14 日 題意:
: Problem A : MiniMice ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11411: Problem A : MiniMice 解題者:李重儀 解題日期: 2008 年 9 月 3 日 題意:簡單的說,題目中每一隻老鼠有一個編號.
: Ahoy, Pirates! ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11402: Ahoy, Pirates! 解題者:李重儀 解題日期: 2008 年 8 月 26 日 題意:有一個海盜島有 N 個海盜,他們的編號 (id)
: Multisets and Sequences ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11023: Multisets and Sequences 解題者:葉貫中 解題日期: 2007 年 4 月 24 日 題意:在這個題目中,我們要定義.
: Robot Motion ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: : Robot Motion 解題者:鄭昀旻 解題日期: 2009 年 5 月 20 日 題意:有一機器人會從網格的上(N)方進入, 依網格上之E、W、S、N之指令來行走,題目.
:Nuts for nuts..Nuts for nuts.. ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 10944:Nuts for nuts.. 解題者:楊家豪 解題日期: 2006 年 2 月 題意: 給定兩個正整數 x,y.
資料結構實習-一 參數傳遞.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2008.
: Beautiful Numbers ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 11472: Beautiful Numbers 解題者:邱經達 解題日期: 2011 年 5 月 5 日 題意: 若一個 N 進位的數用到該.
: Lucky Number ★★★★☆ 題組: Proble Set Archive with Online Judge 題號: 10909: Lucky Number 解題者:李育賢 解題日期: 2008 年 4 月 25 日 題意:給一個奇數數列 1,3,5,7,9,11,13,15…
函式 Function Part.2 東海大學物理系‧資訊教育 施奇廷. 遞迴( Recursion ) 函式可以「呼叫自己」,這種動作稱為 「遞迴」 此程式的執行結果相當於陷入無窮迴圈, 無法停止(只能按 Ctrl-C ) 這給我們一個暗示:函式的遞迴呼叫可以 達到部分迴圈的效果.
演算法 8-1 最大數及最小數找法 8-2 排序 8-3 二元搜尋法.
: Flip Sort ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10327: Flip Sort 解題者:歐子揚 解題日期: 2010 年 2 月 26 日 題意:在這個問題中使用一種排序方式 (Flip) ,意思就是 只能交換相鄰的.
845: Gas Station Numbers ★★★ 題組: Problem Set Archive with Online Judge 題號: 845: Gas Station Numbers. 解題者:張維珊 解題日期: 2006 年 2 月 題意: 將輸入的數字,經過重新排列組合或旋轉數字,得到比原先的數字大,
: Function Overloading ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 11032:Function Overloading 解題者:許智祺 解題日期: 2007 年 5 月 8 日 題意:判對輸入之數字是否為.
質數 (Prime) 相關問題 (III) — 如何找出相對大的質數 Date: May 27, 2009 Introducer: Hsing-Yen Ann.
組合語言與系統程式 軟體使用教學(中文詳細版).
組合語言與系統程式 軟體使用教學. 軟體下載及安裝 下載 到課程網頁下載 tw/~jiun/ 安裝 解壓縮後將 System Software 資料夾放在 D 槽 (C 槽版本放在 C 之下 )
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2009.
計算機概論 第6章 數位邏輯設計.
: Mini Cube ★★★★★ 題組: Problem Set Archive with Online Judge 題號: 11007: Mini Cube 解題者:郭峻維 解題日期: 2007 年 3 月 27 日 題意:找出 2x2x2 的 Rubik‘s cube 的最佳解。
INTRODUCTION TO MATLAB SHAWNNTOU. What Is MATLAB? MATLAB® is a high-performance language for technical computing. MATLAB® is a high-performance language.
第 6 章 迴圈結構 6-1 計數迴圈 6-1 計數迴圈 6-2 條件迴圈 6-2 條件迴圈 6-3 巢狀迴圈 6-3 巢狀迴圈 6-4 While/End While 迴圈 6-4 While/End While 迴圈 6-5 跳出迴圈 6-5 跳出迴圈 6-6 VB.NET 的錯誤處理 6-6 VB.NET.
函式 Function 東海大學物理系‧資訊教育 施奇廷. 函式簡介 當程式越來越大、越複雜時,程式的維護、 除錯會變得更困難,此時必須引入函式來 簡化程式或將程式分段,將程式重複的部 分改寫為函式,將程式「模組化」 這種作法有下列優點:節省程式發展的時 間、邏輯容易瞭解、程式容易除錯、可分 工合作完成程式.
指導教授 : 林啟芳 教授 組員 : 邱秉良 林育賢. 何謂 GPS  GPS 即全球定位系統,是一個中距離圓 型軌道衛星導航系統。它可以為地球表面 絕大部分地區( 98% )提供準確的定位、 測速和高精度的時間標準。
Visual C++重點複習.
1 Introduction to Java Programming Lecture 3 Mathematical Operators Spring 2008.
1 Introduction to Java Programming Lecture 2: Basics of Java Programming Spring 2010.
: SAM I AM ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11419: SAM I AM 解題者:李重儀 解題日期: 2008 年 9 月 11 日 題意: 簡單的說,就是一個長方形的廟裡面有敵人,然 後可以橫的方向開砲或縱向開砲,每次開砲可以.
: Construct the wall maze ★★★★★ 題組: Problem Set Archive with Online Judge 題號: 11050: Construct the wall maze 解題者:宋柏儀 解題日期: 2007 年 6 月 12 日.
7.4 程式範例 在螢幕上寫出“Hello” 的程式 (參考 code/pep-p200.odc).
第8章 字串與陣列 8-1一維陣列的處理 8-2 字串處理 8-3 多維陣列的處理 8-4 動態陣列與參數傳遞 8-5 陣列排序與搜尋.
: Finding Paths in Grid ★★★★☆ 題組: Contest Archive with Online Judge 題號: 11486: Finding Paths in Grid 解題者:李重儀 解題日期: 2008 年 10 月 14 日 題意:給一個 7 個 column.
:Rings and Glue ★★☆☆☆ 題組: Problem Set Archive with Online Judge 題號: 10301: Rings and Glue 解題者:施博修 解題日期: 2011 年 5 月 18 日 題意:小約翰有了個大麻煩,他不小心將 rings.
幼兒行為觀察與記錄 第八章 事件取樣法.
1 Introduction to Java Programming Lecture 3 Mathematical Operators Spring 2009.
第 1 章 PC 的基本構造. 本章提要 PC 系統簡介 80x86 系列 CPU 及其暫存器群 記憶體: Memory 80x86 的分節式記憶體管理 80x86 的 I/O 結構 學習組合語言的基本工具.
: How many 0's? ★★★☆☆ 題組: Problem Set Archive with Online Judge 題號: 11038: How many 0’s? 解題者:楊鵬宇 解題日期: 2007 年 5 月 15 日 題意:寫下題目給的 m 與 n(m
McGraw-Hill/Irwin © 2003 The McGraw-Hill Companies, Inc.,All Rights Reserved. 肆 資料分析與表達.
Presentation transcript:

Maple’s Evaluation Rules 教授 : 蔡桂宏 博士 學生 : 林佳慧 學號 : 統資軟體課程講義

Program Full evaluation Levels of evaluation Delayed evaluation

Program (continue) Last name evaluation Evaluating function definitions Evaluating function calls A no evaluation rule

Program (continue) Evaluating concatenated names Evaluating indexed names Online help for evaluation rules

Full evaluation Introducing the kinds of the data styles by normal programming :  文字 - 字元:『 ’ ’ 』或『 ’’ ’’ 』  數字 - 整數和浮點數: 5 、 5.0  邏輯值( boolean ):『 true 』或『 false 』 What is full evaluation?  一口氣計算完畢

Full evaluation(Continue) There are exceptions to this rule:  delayed evaluation  levels evaluation  last name evaluation

1.Compare 『 : 』和『;』 2.Maple 語法的結尾是用『 : 』和 『;』 3. 交換變數

f := x -> f(x) f(x) 的資料會隨著變數 x 的值改變而 變

Solve 語法: solve( 函數,變數)

此處只有一個變數 (x) Plot 語法: plot( 函數,變數 1 range ,變數 2 range )

Seq 語法: seq( 數學式, i= 下界..上界 )

Levels of evaluation Purpose:  How do we use the command? The command in levels of evaluation eval(expression , level )

Delayed evaluation Purpose :  see the command’s output  Compare 『 Delay 』 of evaluation with 『 Level 』 of evaluation  Compare 『 eval(x) 』 with 『 eval(x,n) 』  What happened to the single quote in left equal sign

Delayed evaluation  What happened to the double quote in left equal sign?  Compare 『 % 』 with 『 eval(x,n) 』  Another mean about the command’s output in 『 ‘ ’ 』  Explain the function output in 『 rand( ) 』  Compare some different in 『 plot( ) 』

Delayed evaluation What is delayed evaluation? 沒有立即要計算變數時使用

Delayed evaluation(continue) The command’s output :  『 ’ 變數 ’ 』 : one delayed evaluation  『 ’’ 變數 ’’ 』 : a doubly delayed evaluation  『 ’’’ 變數 ’’’ 』 : a trebly delayed evaluation

expression X unassigned

function EX.1 C is a delayed parameter

EX.2 We can use delayed evaluation to prevent Maple from making the function call.

EX.3 Compare them…

Delayed evaluation(continue) Compare 『 Delay 』 of evaluation with 『 Level 』 of evaluation  『 Delay 』 - 由原來的表示式看 delay 幾次  『 Level 』 - 『 eval(x,n) 』 : 程式由前面開 始找到 x 後,逐行由上往下顯示

eval(x) 是 eval(eval(x,2))

Delayed evaluation(continue) Compare 『 eval(x) 』 with 『 eval(x,n) 』  The call eval(x) means: Two delayed evaluations.(the same of the eval(eval(x,2)) ) or evaluate x  The call eval(x,n) means: To evaluate the n level of the name x

evaluate a

討論 eval(y,1)

Delayed evaluation(continue) What happened to the single quote in left equal sign  The first x has its evaluation dealyed and the second x is evaluated right away

Delayed evaluation(continue) What happened to the double quote in left equal sign  The first x has its evaluation dealyed and the second x is one delayed evaluated of x

Delayed evaluation(continue) the command’s output in 『 % 』、 『 % 』  『 % 』 :last expression  『 % 』 : second last expression i.e 『 %% 』 : third last expression

Delayed evaluation(continue) Compare 『 % 』 with 『 eval(x,n) 』  『 % 』 : 由此指令往前找一行  『 eval(x,n) 』 : 程式由前面開始找到 x 後, 逐行由上往下顯示

Delayed evaluation(continue) Another mean about the command’s output in 『 ‘ ’ 』 :  It can get automatic simplification  It is a very safe way to define y  It is an often used trick in Maple Explain the command’s output in 『 plot( expression in independent variable x,the range of the x) 』

『 ‘ u+u ‘ 』 doesn ’ t evaluate to 2u, it simplifies to 2u.

『 u+u 』 is evaluated by u=5. 『 ’u+u’ 』 is a simplistic action.

Delayed evaluation(continue) Explain the function output in 『 rand( ) 』 :  It can generate a random interger

You can find there do not return a random fracion. We can try it again by the common as following:

Another way to generate a random fraction:

Delayed evaluation(continue) Compare some different as following:  plot(x^2,x=-5..5); v.s plot(x^2,'x'=-5..5);  plot('x'^2,'x'=-5..5); v.s plot('x'^2, x=-5..5);

There have the same output

Last name evaluation Define:  Maple 在計算函數時, 最後一步計算時的 變數

Last name is f

Last name is k(w) 此處未使用 last name evaluation

Evaluating function definitions Purpose:  Learning how Maple evaluates function calls

If we define f as an expression in x. Now define g as a Maple function.

c is a parameter in the definition of g along with x.

Evaluating function definitions (continue) How do we define Maple function?  use 『 -> 』  use 『 unapply 』 command

Exercise: Explain each the following three sequences of commands.

Evaluating function call If f is the name of a Maple function, then an expression of the form f(any-maple-expression)  f was defined using by 『 -> 』 Here is an example of a function and several function calls

Evaluating function call (continue) Some of the function call:  Case 1 : above this page  Case 2 : unevaluated function call

g(2) is an unevaluated function call. Case 1 Case 2

Evaluating function call (continue) Compare this:

A no evaluation rule Purpose:  There have many examples of how unevaluations are used  Explain the command in 『 assigned( ) 』  What is recursion ?

assign(x=n); x;

Why? Because x:=‘x’

A no evaluation rule(continue) Explain the command in 『 assigned( ) 』 :  The assigned function returns true if n has a value other than its own name, and returns false

這裡是因為遞迴 (x:=‘x’) 所引起

A no evaluation rule(continue) What is recursion?  x=‘x’  f(0)=1 f(1)=1 f(x+2)=f(x+1)+f(x) EX. f(5)=8 f(x) x 電腦記憶體 x 的地方放 x 的位置

Evaluating concatenated names Purpose:  find Maple’s rules for evaluating concatenated names What is a concatenated name?  the concatenated name’s command is 『 || 』

evaln(expression)

使用 w||eval(x,n) 有無括號之差別

The next exercise shows that Maple does allow the use of parentheses for grouping around the right pair of vertical lines.

Evaluating indexed names Purpose:  To understand what indexed name is it Compare 『 x||1:=0 』 with 『 x[1]:=0 』  『 x||1:=0 』 : Maple evaluates x||1 to the name x1  『 x[1]:=0 』 : x[1] is a name. Maple does not need to evaluate it

Online help for evaluation rules Purpose:  Finding many ways to call for help

Online help for evaluation rules (continue) Ways:  『 ? 』  『 F1 』 (version 9)  『 Help/Search 』