本文整理匯總了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
}