Skip to Main Content
Mathematica 錦囊妙計
book

Mathematica 錦囊妙計

by Sal Mangano
April 2014
Beginner to intermediate content levelBeginner to intermediate
830 pages
15h 21m
Chinese
GoTop Information, Inc.
Content preview from Mathematica 錦囊妙計
15.3 互動式操控圖形
|
601
另外還有一個方法能微調互動圖形,便是將繪圖運算較快的選項從其他較慢的選項中獨
立出來。具兩種參數的圖形是一個典型的例子,一種參數是用來改變圖形本身(運算較
慢),另一種是參數用來更改繪圖顯示選項(運算較快),理想上運算較快的參數不應該
觸發運算較慢的參數進行運算,這可以透過
Dynamic[]
指令達到這一點,
Dynamic
指令
將於訣竅 15.11 中詳細討論。[Page-603]
ch15.indd 601 2014/4/2 下午 03:39:54
602
|
第十五章
15.4 建立即時更新的表示式
問題點
你想建立會隨著變數改變並且即時更新的輸出單元。[Page-604]
解決方案
一般而言,表示式運算後輸出是靜態(static)的結果。然而,可將表示式以
Dynamic[]
指令包裝,這告訴 Mathematica 當表示式中的變數更改時,必須即時更新此表示式的輸
出。以下以簡單範例作介紹,分別定義三個變數,並運算一個串列,串列的第一個元
素是三個變數直接加總,而另一個元素使用
Dynamic
包裝加總運算;初始的執行結果不
出意料是
{6,6
},然而當你修改變數
x1
100
時,串列的第二個元素變成新加總結果
105
ch15.indd 602 2014/4/2 下午 03:39:55 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Ubuntu for Non-Geeks, 4th Edition

Ubuntu for Non-Geeks, 4th Edition

Rickford Grant, Phil Bull

Publisher Resources

ISBN: 9789863470106