With all the preliminary work established, we can move on to the optimization problem. We investigated two objective functions for optimization. The first objective function considered was the following
J
(
c
(
t
)
)
=
∫
0
ℓ
(
u
(
x
,
T
;
c
(
t
)
)
-
u
0
(
x
,
T
)
)
2
d
x
.
J
(
c
(
t
)
)
=
∫
0
ℓ
(
u
(
x
,
T
;
c
(
t
)
)
-
u
0
(
x
,
T
)
)
2
d
x
.
(10)Here a suitable time TT is preordained. It is legitimate to do this since damping should not affect the periodic details of the waveform. The u(x,T)u(x,T) is solved with the given c(t)c(t) and fitted to u0(x,T)=sin(4πxℓ)u0(x,T)=sin(4πxℓ). We parameterize
c
(
t
)
=
e
-
c
1
t
-
e
-
c
2
t
c
(
t
)
=
e
-
c
1
t
-
e
-
c
2
t
(11)which acts at one point on the string with a shape similar to the following.
It is important also that c1<c2c1<c2 to guarantee the above shape.
Our control problem then, is to
min
c
1
,
c
2
∫
0
ℓ
(
u
(
x
,
T
;
c
(
t
)
)
-
u
0
(
x
,
T
)
)
2
d
x
min
c
1
,
c
2
∫
0
ℓ
(
u
(
x
,
T
;
c
(
t
)
)
-
u
0
(
x
,
T
)
)
2
d
x
(12)
subject to u(x,T;c(t))u(x,T;c(t)) solving our wave equation with the same initial and boundary conditions. There is a scaling issue since u(x,T)u(x,T) is small (on the order of 10-510-5) at times. To correct this we scale our target u0u0 so that the two waveforms are comparable before we run the optimization. Normalizing uu instead, would be cumbersome since the maximum amplitude depends on time. To expedite the optimizer, we supply the gradient of our objective
∇
J
(
c
(
t
)
)
=
(
∂
J
(
c
(
t
)
)
∂
c
1
,
∂
J
(
c
(
t
)
)
∂
c
2
)
.
∇
J
(
c
(
t
)
)
=
(
∂
J
(
c
(
t
)
)
∂
c
1
,
∂
J
(
c
(
t
)
)
∂
c
2
)
.
(13)The equations for the partial derivatives are as follows.
∂
J
(
c
(
t
)
)
∂
c
1
=
2
∫
0
ℓ
(
u
(
x
,
T
;
c
(
t
)
)
-
u
0
(
x
,
T
)
)
(
∂
u
(
x
,
T
,
c
(
t
)
)
∂
c
1
)
d
x
,
∂
J
(
c
(
t
)
)
∂
c
1
=
2
∫
0
ℓ
(
u
(
x
,
T
;
c
(
t
)
)
-
u
0
(
x
,
T
)
)
(
∂
u
(
x
,
T
,
c
(
t
)
)
∂
c
1
)
d
x
,
(14)
∂
J
(
c
(
t
)
)
∂
c
2
=
2
∫
0
ℓ
(
u
(
x
,
T
;
c
(
t
)
)
-
u
0
(
x
,
T
)
)
(
∂
u
(
x
,
T
,
c
(
t
)
)
∂
c
2
)
d
x
∂
J
(
c
(
t
)
)
∂
c
2
=
2
∫
0
ℓ
(
u
(
x
,
T
;
c
(
t
)
)
-
u
0
(
x
,
T
)
)
(
∂
u
(
x
,
T
,
c
(
t
)
)
∂
c
2
)
d
x
(15)The inner partial derivatives will be approximated by the same finite difference method we used above.
One of the main difficulties with this objective function is that it requires a TT to be found beforehand and thus we can only optimize with respect to our spacial dimension. Optimizing over both space and time would rid us of needing to find a good TT but complicates our objective function and retards our optimizer. Another concern with this objective is that it takes into account the sign of the target waveform, but whether the waveform is sin(x)sin(x) or -sin(x)-sin(x) is no matter to the musician. Along the same lines we have the scaling difficulty. Another objective function we have explored is the following energy minimization problem. We note that u(x,t)u(x,t) can be represented as a combination of sinusoids. For a given TT we have
u
(
x
,
T
)
=
∑
n
=
1
N
u
n
sin
(
2
n
π
x
ℓ
)
.
u
(
x
,
T
)
=
∑
n
=
1
N
u
n
sin
(
2
n
π
x
ℓ
)
.
(16)Here each unun represents the nth Fourier coefficient that corresponds to the expression of the nth mode in the total wave. Since we are interested in expressing only the fourth mode, our optimization problem will try to minimize all other modes
min
c
1
,
c
2
F
(
c
(
t
)
)
=
∫
0
T
f
i
n
∑
n
=
1
,
n
≠
4
10
∫
0
ℓ
(
u
(
x
,
t
;
c
(
t
)
)
sin
n
π
x
ℓ
d
x
2
d
t
min
c
1
,
c
2
F
(
c
(
t
)
)
=
∫
0
T
f
i
n
∑
n
=
1
,
n
≠
4
10
∫
0
ℓ
(
u
(
x
,
t
;
c
(
t
)
)
sin
n
π
x
ℓ
d
x
2
d
t
(17)
subject to our wave equation with the same conditions. We decide on clearing up the first ten modes (except the fourth) to ensure that we are left with a waveform closest to our target. Like before we supply the gradient.
∂
F
(
c
(
t
)
)
∂
c
1
=
2
∫
0
T
f
i
n
∑
n
=
1
,
n
≠
4
10
∫
0
ℓ
(
u
(
x
,
t
;
c
(
t
)
)
sin
n
π
x
ℓ
∂
u
(
x
,
t
,
c
(
t
)
)
∂
c
1
d
x
d
t
,
∂
F
(
c
(
t
)
)
∂
c
1
=
2
∫
0
T
f
i
n
∑
n
=
1
,
n
≠
4
10
∫
0
ℓ
(
u
(
x
,
t
;
c
(
t
)
)
sin
n
π
x
ℓ
∂
u
(
x
,
t
,
c
(
t
)
)
∂
c
1
d
x
d
t
,
(18)
∂
F
(
c
(
t
)
)
∂
c
2
=
2
∫
0
T
f
i
n
∑
n
=
1
,
n
≠
4
10
∫
0
ℓ
(
u
(
x
,
t
;
c
(
t
)
)
sin
n
π
x
ℓ
∂
u
(
x
,
t
,
c
(
t
)
)
∂
c
2
d
x
d
t
.
∂
F
(
c
(
t
)
)
∂
c
2
=
2
∫
0
T
f
i
n
∑
n
=
1
,
n
≠
4
10
∫
0
ℓ
(
u
(
x
,
t
;
c
(
t
)
)
sin
n
π
x
ℓ
∂
u
(
x
,
t
,
c
(
t
)
)
∂
c
2
d
x
d
t
.
(19)This objective function solves the sign and amplitude problems of the first. Additionally we are now optimizing over time so we need not specify a TT. One may wish to reset the bounds of the time integral through a different interval.