import{_ as n,c as s,j as a,a as Q,a4 as t,o as i}from"./chunks/framework.DpC1ZpOZ.js";const V=JSON.parse('{"title":"mbcp.mp_math.function","description":"","frontmatter":{"title":"mbcp.mp_math.function","lastUpdated":false},"headers":[],"relativePath":"ja/api/mp_math/function.md","filePath":"ja/api/mp_math/function.md"}'),T={name:"ja/api/mp_math/function.md"},e=t('

モジュール mbcp.mp_math.function

AAA


func cal_gradient_3vf(func: ThreeSingleVarsFunc, p: Point3, epsilon: float = EPSILON) -> Vector3

説明: 计算三元函数在某点的梯度向量。

',5),l={class:"tip custom-block github-alert"},h=a("p",{class:"custom-block-title"},"TIP",-1),r={class:"MathJax",jax:"SVG",style:{direction:"ltr",position:"relative"}},d={style:{overflow:"visible","min-height":"1px","min-width":"1px","vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"8.471ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 3744.3 1000","aria-hidden":"true"},p=t('',1),o=[p],m=a("mjx-assistive-mml",{unselectable:"on",display:"inline",style:{top:"0px",left:"0px",clip:"rect(1px, 1px, 1px, 1px)","-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none",position:"absolute",padding:"1px 0px 0px 0px",border:"0px",display:"block",width:"auto",overflow:"hidden"}},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",null,"f"),a("mo",{stretchy:"false"},"("),a("mi",null,"x"),a("mo",null,","),a("mi",null,"y"),a("mo",null,","),a("mi",null,"z"),a("mo",{stretchy:"false"},")")])],-1),k={class:"MathJax",jax:"SVG",style:{direction:"ltr",position:"relative"}},c={style:{overflow:"visible","min-height":"1px","min-width":"1px","vertical-align":"-0.566ex"},xmlns:"http://www.w3.org/2000/svg",width:"10.19ex",height:"2.262ex",role:"img",focusable:"false",viewBox:"0 -750 4504 1000","aria-hidden":"true"},g=t('',1),u=[g],y=a("mjx-assistive-mml",{unselectable:"on",display:"inline",style:{top:"0px",left:"0px",clip:"rect(1px, 1px, 1px, 1px)","-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none",position:"absolute",padding:"1px 0px 0px 0px",border:"0px",display:"block",width:"auto",overflow:"hidden"}},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mo",{stretchy:"false"},"("),a("msub",null,[a("mi",null,"x"),a("mn",null,"0")]),a("mo",null,","),a("msub",null,[a("mi",null,"y"),a("mn",null,"0")]),a("mo",null,","),a("msub",null,[a("mi",null,"z"),a("mn",null,"0")]),a("mo",{stretchy:"false"},")")])],-1),E={class:"MathJax",jax:"SVG",style:{direction:"ltr",position:"relative"}},f={style:{overflow:"visible","min-height":"1px","min-width":"1px","vertical-align":"-1.469ex"},xmlns:"http://www.w3.org/2000/svg",width:"29.427ex",height:"4.07ex",role:"img",focusable:"false",viewBox:"0 -1149.5 13006.8 1799","aria-hidden":"true"},_=t('',1),w=[_],x=a("mjx-assistive-mml",{unselectable:"on",display:"inline",style:{top:"0px",left:"0px",clip:"rect(1px, 1px, 1px, 1px)","-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none",position:"absolute",padding:"1px 0px 0px 0px",border:"0px",display:"block",width:"auto",overflow:"hidden"}},[a("math",{xmlns:"http://www.w3.org/1998/Math/MathML"},[a("mi",{mathvariant:"normal"},"∇"),a("mi",null,"f"),a("mo",{stretchy:"false"},"("),a("msub",null,[a("mi",null,"x"),a("mn",null,"0")]),a("mo",null,","),a("msub",null,[a("mi",null,"y"),a("mn",null,"0")]),a("mo",null,","),a("msub",null,[a("mi",null,"z"),a("mn",null,"0")]),a("mo",{stretchy:"false"},")"),a("mo",null,"="),a("mrow",{"data-mjx-texclass":"INNER"},[a("mo",{"data-mjx-texclass":"OPEN"},"("),a("mfrac",null,[a("mrow",null,[a("mi",null,"∂"),a("mi",null,"f")]),a("mrow",null,[a("mi",null,"∂"),a("mi",null,"x")])]),a("mo",null,","),a("mfrac",null,[a("mrow",null,[a("mi",null,"∂"),a("mi",null,"f")]),a("mrow",null,[a("mi",null,"∂"),a("mi",null,"y")])]),a("mo",null,","),a("mfrac",null,[a("mrow",null,[a("mi",null,"∂"),a("mi",null,"f")]),a("mrow",null,[a("mi",null,"∂"),a("mi",null,"z")])]),a("mo",{"data-mjx-texclass":"CLOSE"},")")])])],-1),b=t(`

引数:

戻り値: 梯度

ソースコード または GitHubで表示
python
def cal_gradient_3vf(func: ThreeSingleVarsFunc, p: Point3, epsilon: float=EPSILON) -> Vector3:
    dx = (func(p.x + epsilon, p.y, p.z) - func(p.x - epsilon, p.y, p.z)) / (2 * epsilon)
    dy = (func(p.x, p.y + epsilon, p.z) - func(p.x, p.y - epsilon, p.z)) / (2 * epsilon)
    dz = (func(p.x, p.y, p.z + epsilon) - func(p.x, p.y, p.z - epsilon)) / (2 * epsilon)
    return Vector3(dx, dy, dz)

func curry(func: MultiVarsFunc, *args: Var) -> OneVarFunc

説明: 对多参数函数进行柯里化。

TIP

有关函数柯里化,可参考函数式编程--柯理化(Currying)

引数:

戻り値: 柯里化后的函数

:

python
def add(a: int, b: int, c: int) -> int:
    return a + b + c
add_curried = curry(add, 1, 2)
add_curried(3)  # 6
ソースコード または GitHubで表示
python
def curry(func: MultiVarsFunc, *args: Var) -> OneVarFunc:

    def curried_func(*args2: Var) -> Var:
        return func(*args, *args2)
    return curried_func
`,14);function L(H,F,M,v,D,Z){return i(),s("div",null,[e,a("div",l,[h,a("p",null,[Q("已知一个函数"),a("mjx-container",r,[(i(),s("svg",d,o)),m]),Q(",则其在点"),a("mjx-container",k,[(i(),s("svg",c,u)),y]),Q("处的梯度向量为: "),a("mjx-container",E,[(i(),s("svg",f,w)),x])])]),b])}const A=n(T,[["render",L]]);export{V as __pageData,A as default};