Skip to content

Commit

Permalink
unittest: Add more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkleiven committed Apr 17, 2020
1 parent a6e4b59 commit 90d1223
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions nonlin/newtonBCGS_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,34 @@ func TestBicStab(t *testing.T) {
Solution: []float64{1.0, 1.0},
Tol: 1e-4,
},
{
F: func(out []float64, x []float64) {
out[0] = math.Cos(x[0]) - 9.0 + 3.0*x[0] + 8*math.Exp(x[1])
out[1] = math.Cos(x[1]) - 9.0 + 3.0*x[1] + 8*math.Exp(x[0])
out[2] = math.Cos(x[2]) - x[2] - 1.0
},
Init: []float64{0.1, 0.35, 2.4},
Solution: []float64{0.0, 0.0, 0.0},
Tol: 1e-4,
},
{
F: func(out []float64, x []float64) {
out[0] = math.Sqrt(3.0)*x[0]*x[0] - x[1]*x[1]
out[1] = math.Cos(x[0]) - 1.0/(1.0+x[1]*x[1])
},
Init: []float64{0.5, 3.0},
Solution: []float64{0.0, 0.0},
Tol: 1e-4,
},
{
F: func(out []float64, x []float64) {
out[0] = 2.0/(1.0+x[0]*x[0]) + math.Sin(x[1]-1.0) - 1.0
out[1] = math.Sin(x[1]-1.0) + 2.0/(1.0+x[1]*x[1]) - 1.0
},
Init: []float64{0.5, 0.34},
Solution: []float64{1.0, 1.0},
Tol: 1e-4,
},
} {
solver := NewtonBCGS{
Maxiter: 1000,
Expand Down

0 comments on commit 90d1223

Please sign in to comment.