查看“︁Template:數列/doc”︁的源代码
←
Template:數列/doc
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{NoteTA|G1=MediaWiki}}{{Documentation subpage}}<!-- 在本行下編輯模板說明 --> {{Lua|NumberUtil}} == 概要 == 根據指定數學式(以{{tl|複變運算}}為基礎)產生一個數列。 == 參數及使用方法 == :<code><nowiki>{{數列 | 顯示模式,$1會填入數列項 | 從哪項開始列 | 列到哪一項 | 以x表示數列}}</nowiki></code> *例如要產生一個平方數<code>x^2</code>的數列,可以使用以下語法 *:{{tlx|數列|{{0| }}$, {{0| }}|{{0| }}1{{0| }}|{{0| }}10{{0| }}|{{0| }}x^2}} *::→{{數列|$, |1|10|x^2}} *亦可以指定最初項,定義遞迴的數列,例如[[斐波那契数|斐波那契数列]]<math>F_n = F_{n-1}+ F_{n-2}</math>,表達式以<code>last(1)+last(2)</code>表示前兩項的和,並定義參數{{para|last1|1}},完整語法如下: *:{{tlx|數列|{{0| }}$, {{0| }}|{{0| }}1{{0| }}|{{0| }}10{{0| }}|{{0| }}last(1)+last(2){{0| }}|{{0| }}last1{{=}}1}} *::→{{數列|$, |1|10|last(1)+last(2)|last1=1}} 關於數列表達式可用語法詳見以下說明: {{HideH|詳細運算符、常數及函數列表}} ===語法=== {{複變運算/語法 |constantJson={ "x":{ "othername":[], "name":"數列序號", "description":"數列目前之項的序號", "value":"x", "title":"數列" } } |functionJson={ "last":{ "othername":[], "count":1, "name":"前項", "description":"表達前n項", "title":"數列" }, "質數":{ "othername":["素數"], "count":1, "name":"質數", "description":"第n個質數", "title":"质数" } } |constantExt=x |functionExt=last,質數 }} {{HideF}} === 模板數據 === {{TemplateDataHeader}} {{HideH|模板數據}} <templatedata> { "params": { "1": { "label": "顯示模式", "description": "顯示模式,$會填入數列項", "type": "content", "required": true }, "2": { "aliases": [ "min" ], "label": "數列首項", "description": "數列第一項的x值", "type": "number", "required": true }, "3": { "aliases": [ "max" ], "label": "數列末項", "description": "數列最後一項的x值", "type": "number", "required": true }, "4": { "label": "運算式", "description": "以x表達數列的運算式", "type": "string", "required": true }, "5": { "label": "運算式的變數", "description": "若運算式的變數非x,則可以用此參數指定運算式的變數", "default": "x", "type": "string" }, "class": { "label": "運算數字模式", "description": "要運算的數字模式,可以是實數、cmath(複數)、qmath(四元數)、no calc(不計算)、mathtag(以<math>輸出)或直接寫Module:模組名稱.運算庫來指定使用特定模組來運算。", "type": "string", "default": "cmath" }, "series": { "label": "是否為級數", "description": "若需要計算數列的級數,將此參數設為是。", "type": "boolean", "default": "no" }, "raw_value": { "label": "是否為原始資料", "description": "是否以運算結果的原始資料輸出", "type": "boolean", "default": "no" }, "delnowiki": { "label": "是否去除<nowiki>", "description": "是否去除參數1中的<nowiki>", "type": "boolean", "default": "no" }, "delmsgnw": { "label": "是否去除msgnw", "description": "是否去除參數1中的msgnw", "type": "boolean", "default": "no" }, "last1": { "label": "首項的前1項", "type": "string" }, "last2": { "label": "首項的前2項", "type": "string" }, "preprocess": { "label": "是否視為維基代碼", "description": "是否將整個結果視為維基代碼再次呼叫解析。用於參數1有要將結果輸進模板的情況", "type": "boolean", "default": "no" }, "template": { "label": "模板模式", "description": "是否啟用模板模式。使用模板模式時,運算式請使用維基代碼表達要列的數列,當中的$會自動替換成數值", "type": "boolean", "default": "no" } }, "paramOrder": [ "1", "2", "3", "4", "5", "class", "series", "raw_value", "delnowiki", "delmsgnw", "last1", "last2", "preprocess", "template" ], "description": "產生一個數列" } </templatedata> {{HideF}} === 模板模式 === 當表達式無法表達,只能透過模板呼叫時,可以使用模板模式: :<code><nowiki>{{數列 | 顯示模式,$1會填入數列項 | 從哪項開始列 | 列到哪一項 | 使用維基代碼表達要列的數列,當中的$會自動替換成數值 | template=yes}}</nowiki></code> *例如要產生一個{{tlx|進制|2|n}}的數列,可以使用以下語法 *:{{tlx|數列|{{0| }}$, {{0| }}|{{0| }}1{{0| }}|{{0| }}10{{0| }}|{{0| }}<nowiki><no</nowiki>wiki>{{tlx|進制|2|$}}<nowiki></no</nowiki>wiki>{{0| }}|{{0| }}template{{=}}yes}} *::→{{數列|$, |1|10|<nowiki>{{進制|2|$}}</nowiki>|template=yes}} *作為數列的模板語法必須防止提前解析,可使用跳脫字元<code>\</code>及魔術字{{tlx|!}}: *:{{tlx|數列|{{0| }}$, {{0| }}|{{0| }}1{{0| }}|{{0| }}10{{0| }}|{{0| }}{\{進制{{tlx|!}}2{{tlx|!}}$}\}{{0| }}|{{0| }}template{{=}}yes}} *::→{{數列|$, |1|10|{\{進制{{!}}2{{!}}$}\}|template=yes}} == 範例 == {| |- |colspan=4| *產生一個[[質數]]的數列: |- |{{0| }}{{0| }}{{0| }}{{0| }}{{0| }}{{0| }} |{{tlx|數列|{{0| }}$, {{0| }}|{{0| }}1{{0| }}|{{0| }}10{{0| }}|{{0| }}質數(x)}} |→ |「{{數列|$, |1|10|質數(x)}}」 |- |colspan=4| *產生一個[[質數]]的表格: |- |{{0| }}{{0| }}{{0| }}{{0| }}{{0| }}{{0| }} |<syntaxhighlight lang="wikitext">{| class=wikitable {{數列|{{!!}} $ |1|10|質數(x)}} |}</syntaxhighlight> |→ | {| class=wikitable {{數列|{{!!}} $ |1|10|質數(x)}} |} |} == 參見 == *{{tl|運算樣例}} <includeonly>{{Sandbox other||<!-- 本行下加入模板的分類 --> [[Category:數學模板]] }}</includeonly>
该页面使用的模板:
Template:0
(
查看源代码
)
Template:Documentation subpage
(
查看源代码
)
Template:HideF
(
查看源代码
)
Template:HideH
(
查看源代码
)
Template:Lua
(
查看源代码
)
Template:NoteTA
(
查看源代码
)
Template:Para
(
查看源代码
)
Template:TemplateDataHeader
(
查看源代码
)
Template:Tl
(
查看源代码
)
Template:Tlx
(
查看源代码
)
Template:數列
(
查看源代码
)
Template:複變運算/語法
(
查看源代码
)
返回
Template:數列/doc
。
导航菜单
个人工具
登录
命名空间
模板
讨论
不转换
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
工具
链入页面
相关更改
页面信息