mirror of
https://github.com/gonum/gonum.git
synced 2025-10-16 20:20:41 +08:00
all: convert ' to ′ and '' to ′′
This is necessary because gofmt in go1.19 imposes smart quotes on comments that use pairs of single quotes. Doubled-up single tick, U+2032, is chosen over double tick, U+2033, since the latter is harder to distinguish in many fonts at normally used font sizes, sometimes being indistinguishable from other superscript marks such as asterisk. Comparison: ′ ″ *
This commit is contained in:
@@ -17,14 +17,14 @@ func ExampleDerivative() {
|
|||||||
return math.Sin(x)
|
return math.Sin(x)
|
||||||
}
|
}
|
||||||
// Compute the first derivative of f at 0 using the default settings.
|
// Compute the first derivative of f at 0 using the default settings.
|
||||||
fmt.Println("f'(0) ≈", fd.Derivative(f, 0, nil))
|
fmt.Println("f′(0) ≈", fd.Derivative(f, 0, nil))
|
||||||
// Compute the first derivative of f at 0 using the forward approximation
|
// Compute the first derivative of f at 0 using the forward approximation
|
||||||
// with a custom step size.
|
// with a custom step size.
|
||||||
df := fd.Derivative(f, 0, &fd.Settings{
|
df := fd.Derivative(f, 0, &fd.Settings{
|
||||||
Formula: fd.Forward,
|
Formula: fd.Forward,
|
||||||
Step: 1e-3,
|
Step: 1e-3,
|
||||||
})
|
})
|
||||||
fmt.Println("f'(0) ≈", df)
|
fmt.Println("f′(0) ≈", df)
|
||||||
|
|
||||||
f = func(x float64) float64 {
|
f = func(x float64) float64 {
|
||||||
return math.Pow(math.Cos(x), 3)
|
return math.Pow(math.Cos(x), 3)
|
||||||
@@ -38,12 +38,12 @@ func ExampleDerivative() {
|
|||||||
OriginKnown: true,
|
OriginKnown: true,
|
||||||
OriginValue: f(0),
|
OriginValue: f(0),
|
||||||
})
|
})
|
||||||
fmt.Println("f''(0) ≈", df)
|
fmt.Println("f′′(0) ≈", df)
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
// f'(0) ≈ 1
|
// f′(0) ≈ 1
|
||||||
// f'(0) ≈ 0.9999998333333416
|
// f′(0) ≈ 0.9999998333333416
|
||||||
// f''(0) ≈ -2.999999981767587
|
// f′′(0) ≈ -2.999999981767587
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExampleJacobian() {
|
func ExampleJacobian() {
|
||||||
|
@@ -371,7 +371,7 @@ func makeCubicSplineSecondDerivativeEquations(a mat.MutableBanded, b mat.Mutable
|
|||||||
// NaturalCubic is a piecewise cubic 1-dimensional interpolator with
|
// NaturalCubic is a piecewise cubic 1-dimensional interpolator with
|
||||||
// continuous value, first and second derivatives, which can be fitted to (X, Y)
|
// continuous value, first and second derivatives, which can be fitted to (X, Y)
|
||||||
// value pairs without providing derivatives. It uses the boundary conditions
|
// value pairs without providing derivatives. It uses the boundary conditions
|
||||||
// Y''(left end ) = Y''(right end) = 0.
|
// Y′′(left end ) = Y′′(right end) = 0.
|
||||||
// See e.g. https://www.math.drexel.edu/~tolya/cubicspline.pdf for details.
|
// See e.g. https://www.math.drexel.edu/~tolya/cubicspline.pdf for details.
|
||||||
type NaturalCubic struct {
|
type NaturalCubic struct {
|
||||||
cubic PiecewiseCubic
|
cubic PiecewiseCubic
|
||||||
@@ -396,7 +396,7 @@ func (nc *NaturalCubic) Fit(xs, ys []float64) error {
|
|||||||
a := mat.NewTridiag(n, nil, nil, nil)
|
a := mat.NewTridiag(n, nil, nil, nil)
|
||||||
b := mat.NewVecDense(n, nil)
|
b := mat.NewVecDense(n, nil)
|
||||||
makeCubicSplineSecondDerivativeEquations(a, b, xs, ys)
|
makeCubicSplineSecondDerivativeEquations(a, b, xs, ys)
|
||||||
// Add boundary conditions y''(left) = y''(right) = 0:
|
// Add boundary conditions y′′(left) = y′′(right) = 0:
|
||||||
b.SetVec(0, 0)
|
b.SetVec(0, 0)
|
||||||
b.SetVec(n-1, 0)
|
b.SetVec(n-1, 0)
|
||||||
a.SetBand(0, 0, 1)
|
a.SetBand(0, 0, 1)
|
||||||
@@ -412,7 +412,7 @@ func (nc *NaturalCubic) Fit(xs, ys []float64) error {
|
|||||||
// ClampedCubic is a piecewise cubic 1-dimensional interpolator with
|
// ClampedCubic is a piecewise cubic 1-dimensional interpolator with
|
||||||
// continuous value, first and second derivatives, which can be fitted to (X, Y)
|
// continuous value, first and second derivatives, which can be fitted to (X, Y)
|
||||||
// value pairs without providing derivatives. It uses the boundary conditions
|
// value pairs without providing derivatives. It uses the boundary conditions
|
||||||
// Y'(left end ) = Y'(right end) = 0.
|
// Y′(left end ) = Y′(right end) = 0.
|
||||||
type ClampedCubic struct {
|
type ClampedCubic struct {
|
||||||
cubic PiecewiseCubic
|
cubic PiecewiseCubic
|
||||||
}
|
}
|
||||||
@@ -436,13 +436,13 @@ func (cc *ClampedCubic) Fit(xs, ys []float64) error {
|
|||||||
a := mat.NewTridiag(n, nil, nil, nil)
|
a := mat.NewTridiag(n, nil, nil, nil)
|
||||||
b := mat.NewVecDense(n, nil)
|
b := mat.NewVecDense(n, nil)
|
||||||
makeCubicSplineSecondDerivativeEquations(a, b, xs, ys)
|
makeCubicSplineSecondDerivativeEquations(a, b, xs, ys)
|
||||||
// Add boundary conditions y''(left) = y''(right) = 0:
|
// Add boundary conditions y′′(left) = y′′(right) = 0:
|
||||||
// Condition Y'(left end) = 0:
|
// Condition Y′(left end) = 0:
|
||||||
dxL := xs[1] - xs[0]
|
dxL := xs[1] - xs[0]
|
||||||
b.SetVec(0, (ys[1]-ys[0])/dxL)
|
b.SetVec(0, (ys[1]-ys[0])/dxL)
|
||||||
a.SetBand(0, 0, dxL/3)
|
a.SetBand(0, 0, dxL/3)
|
||||||
a.SetBand(0, 1, dxL/6)
|
a.SetBand(0, 1, dxL/6)
|
||||||
// Condition Y'(right end) = 0:
|
// Condition Y′(right end) = 0:
|
||||||
m := n - 1
|
m := n - 1
|
||||||
dxR := xs[m] - xs[m-1]
|
dxR := xs[m] - xs[m-1]
|
||||||
b.SetVec(m, (ys[m]-ys[m-1])/dxR)
|
b.SetVec(m, (ys[m]-ys[m-1])/dxR)
|
||||||
|
@@ -8,7 +8,7 @@ import "gonum.org/v1/gonum/mathext/internal/amos"
|
|||||||
|
|
||||||
// AiryAi returns the value of the Airy function at z. The Airy function here,
|
// AiryAi returns the value of the Airy function at z. The Airy function here,
|
||||||
// Ai(z), is one of the two linearly independent solutions to
|
// Ai(z), is one of the two linearly independent solutions to
|
||||||
// y'' - y*z = 0.
|
// y′′ - y*z = 0.
|
||||||
// See http://mathworld.wolfram.com/AiryFunctions.html for more detailed information.
|
// See http://mathworld.wolfram.com/AiryFunctions.html for more detailed information.
|
||||||
func AiryAi(z complex128) complex128 {
|
func AiryAi(z complex128) complex128 {
|
||||||
// id specifies the order of the derivative to compute,
|
// id specifies the order of the derivative to compute,
|
||||||
@@ -23,7 +23,7 @@ func AiryAi(z complex128) complex128 {
|
|||||||
|
|
||||||
// AiryAiDeriv returns the value of the derivative of the Airy function at z. The
|
// AiryAiDeriv returns the value of the derivative of the Airy function at z. The
|
||||||
// Airy function here, Ai(z), is one of the two linearly independent solutions to
|
// Airy function here, Ai(z), is one of the two linearly independent solutions to
|
||||||
// y'' - y*z = 0.
|
// y′′ - y*z = 0.
|
||||||
// See http://mathworld.wolfram.com/AiryFunctions.html for more detailed information.
|
// See http://mathworld.wolfram.com/AiryFunctions.html for more detailed information.
|
||||||
func AiryAiDeriv(z complex128) complex128 {
|
func AiryAiDeriv(z complex128) complex128 {
|
||||||
// id specifies the order of the derivative to compute,
|
// id specifies the order of the derivative to compute,
|
||||||
|
@@ -24,12 +24,12 @@ func ExampleNumber_fike() {
|
|||||||
|
|
||||||
v := fn(hyperdual.Number{Real: 1.5, E1mag: 1, E2mag: 1})
|
v := fn(hyperdual.Number{Real: 1.5, E1mag: 1, E2mag: 1})
|
||||||
fmt.Printf("v=%.4f\n", v)
|
fmt.Printf("v=%.4f\n", v)
|
||||||
fmt.Printf("fn(1.5)=%.4f\nfn'(1.5)=%.4f\nfn''(1.5)=%.4f\n", v.Real, v.E1mag, v.E1E2mag)
|
fmt.Printf("fn(1.5)=%.4f\nfn′(1.5)=%.4f\nfn′′(1.5)=%.4f\n", v.Real, v.E1mag, v.E1E2mag)
|
||||||
|
|
||||||
// Output:
|
// Output:
|
||||||
//
|
//
|
||||||
// v=(4.4978+4.0534ϵ₁+4.0534ϵ₂+9.4631ϵ₁ϵ₂)
|
// v=(4.4978+4.0534ϵ₁+4.0534ϵ₂+9.4631ϵ₁ϵ₂)
|
||||||
// fn(1.5)=4.4978
|
// fn(1.5)=4.4978
|
||||||
// fn'(1.5)=4.0534
|
// fn′(1.5)=4.0534
|
||||||
// fn''(1.5)=9.4631
|
// fn′′(1.5)=9.4631
|
||||||
}
|
}
|
||||||
|
@@ -301,13 +301,13 @@ func TestHyperdual(t *testing.T) {
|
|||||||
t.Errorf("unexpected %s(%v): got:%v want:%v", test.name, x, fxHyperdual.Real, fx)
|
t.Errorf("unexpected %s(%v): got:%v want:%v", test.name, x, fxHyperdual.Real, fx)
|
||||||
}
|
}
|
||||||
if !same(fxHyperdual.E1mag, dFx, tol) {
|
if !same(fxHyperdual.E1mag, dFx, tol) {
|
||||||
t.Errorf("unexpected %s'(%v) (ϵ₁): got:%v want:%v", test.name, x, fxHyperdual.E1mag, dFx)
|
t.Errorf("unexpected %s′(%v) (ϵ₁): got:%v want:%v", test.name, x, fxHyperdual.E1mag, dFx)
|
||||||
}
|
}
|
||||||
if !same(fxHyperdual.E1mag, fxHyperdual.E2mag, tol) {
|
if !same(fxHyperdual.E1mag, fxHyperdual.E2mag, tol) {
|
||||||
t.Errorf("mismatched ϵ₁ and ϵ₂ for %s(%v): ϵ₁:%v ϵ₂:%v", test.name, x, fxHyperdual.E1mag, fxHyperdual.E2mag)
|
t.Errorf("mismatched ϵ₁ and ϵ₂ for %s(%v): ϵ₁:%v ϵ₂:%v", test.name, x, fxHyperdual.E1mag, fxHyperdual.E2mag)
|
||||||
}
|
}
|
||||||
if !same(fxHyperdual.E1E2mag, d2Fx, tol) {
|
if !same(fxHyperdual.E1E2mag, d2Fx, tol) {
|
||||||
t.Errorf("unexpected %s''(%v): got:%v want:%v", test.name, x, fxHyperdual.E1E2mag, d2Fx)
|
t.Errorf("unexpected %s′′(%v): got:%v want:%v", test.name, x, fxHyperdual.E1E2mag, d2Fx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user