95503统资软体课程讲义.pptVIP

  • 15
  • 0
  • 约1.57万字
  • 约 97页
  • 2020-08-21 发布于湖北
  • 举报
95503統資軟體課程講義 Maple Procedures 指導教授:蔡桂宏 博士 學生 :熊承慧 學號 :AGENDA Difference Main Topic Execution Group Procedures Parameter, Local, Global variables Execution vs. Procedure Use the Procedure Maple function=procedure AGENDA Anonymous procedures Procedures data structures Procedure data structure Remember tables Recursion procedures Skills to create procedure execution group Difference Underlying Idea Maple expression~~ data structure Maple function~~ procedure Initial Definition Data structure~~ a collection of data Procedure~~ a collection of instructions Main Topic Know the meaning of a collection of instructions How to turn a collection of instructions into a procedure Know a procedure is more than a collection of instructions How mathematical functions can be represented by Maple procedures How procedures can manipulate data structures Execution Group Procedures Execution Group Procedures Execution Group Procedures Execution Group Procedures Execution Group Procedures Parameter, Local, Global variables plus := proc(x,y) local a, b; global c; a := x - y; b := x * y; c := x ^ y; x + y; # the return value end; Parameter, Local, Global variables local variables only live inside the procedure call. global variables inside procedure bodies are really the same as the variables we use in commands at our worksheet prompts. Parameter, Local, Global variables plus( 2, 5 ); Execution vs. Procedure ex2 find the i th digit (from the right) of an integer put commands in an execution group n := 200!: i := 50: 10^(-i)*n: moves the decimal point to the left of the ith digit of frac( % ): get the fractional part of the last result 10*%: moves the decimal point over to the right one place trunc( % ); truncates off the fractional part of the last result leaving us with just the digit we want Execution vs. Procedure put commands into the body of a procedure get

文档评论(0)

1亿VIP精品文档

相关文档