本文整理汇总了Golang中github.com/tflovorn/scExplorer/tempAll.Environment.Mu_h方法的典型用法代码示例。如果您正苦于以下问题:Golang Environment.Mu_h方法的具体用法?Golang Environment.Mu_h怎么用?Golang Environment.Mu_h使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/tflovorn/scExplorer/tempAll.Environment
的用法示例。
在下文中一共展示了Environment.Mu_h方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: dFdMu_h
// Partial derivative of F (some function of env) with respect to Mu_h;
// T and V held constant.
func dFdMu_h(env *tempAll.Environment, F envFunc) (float64, error) {
ct := 0
// G gets F given Mu_h (allow x to vary; constant Beta)
G := func(Mu_h float64) (float64, error) {
ct += 1
// save the environment state before changing it
// (don't want one call of F to affect the next)
oD1, oMu_h, oX, oMu_b := env.D1, env.Mu_h, env.X, env.Mu_b
env.Mu_h = Mu_h
// fix free variables2
eps := 1e-9
_, err := D1F0XSolve(env, eps, eps)
if err != nil {
return 0.0, err
}
vF, err := F(env)
if err != nil {
return 0.0, err
}
// restore the environment
env.D1, env.Mu_h, env.X, env.Mu_b = oD1, oMu_h, oX, oMu_b
return vF, nil
}
h := 1e-4
epsAbs := 1e-5
deriv, err := solve.OneDimDerivative(G, env.Mu_h, h, epsAbs)
//fmt.Println("dF_dMu ct", ct)
return deriv, err
}
示例2: SolveNoninteracting
func SolveNoninteracting(env *tempAll.Environment, epsAbs, epsRel float64) (vec.Vector, error) {
env.F0 = 0.0
env.Mu_h = 0.3
env.Beta = 50.0
system, start := NoninteractingSystem(env)
solution, err := solve.MultiDim(system, start, epsAbs, epsRel)
if err != nil {
return nil, err
}
return solution, nil
}
示例3: CritTempStages
// For use with solve.Iterative:
func CritTempStages(env *tempAll.Environment) ([]solve.DiffSystem, []vec.Vector, func([]vec.Vector)) {
vars0 := []string{"D1", "Mu_h"}
vars1 := []string{"Beta"}
diffD1 := tempPair.AbsErrorD1(env, vars0)
diffMu_h := tempPair.AbsErrorBeta(env, vars0)
system0 := solve.Combine([]solve.Diffable{diffD1, diffMu_h})
diffBeta := AbsErrorBeta(env, vars1)
system1 := solve.Combine([]solve.Diffable{diffBeta})
stages := []solve.DiffSystem{system0, system1}
start := []vec.Vector{[]float64{env.D1, env.Mu_h}, []float64{env.Beta}}
accept := func(x []vec.Vector) {
env.D1 = x[0][0]
env.Mu_h = x[0][1]
env.Beta = x[1][0]
}
return stages, start, accept
}