# Impose a boundary condition to a function

Background

I am trying to impose a boundary condition on a function of two variables $u(x_1,x_2)$. The boundary condition is: $u(x_1,0)=A\cos(\omega x_1)$. The same function in mathematica $u(x_1,0)$ (before imposing the boundary conditions) is:

1. a12x q1x Cos[omega x1] - 1. a12y q1y Cos[omega x1] + 1. a22x q2x Cos[omega x1] - 1. a22y q2y Cos[omega x1] + a32x q3x Cos[omega x1] - a32y q3y Cos[omega x1] + 1. a12y q1x Sin[omega x1] + 1. a12x q1y Sin[omega x1] + 1. a22y q2x Sin[omega x1] + 1. a22x q2y Sin[omega x1] + a32y q3x Sin[omega x1] + a32x q3y Sin[omega x1]


As you can see this function contains both sine and cosine components with several constants like a12x, q1x, a12y etc. I want to use the boundary condition to get two constants say q1x and q1y, in terms of other constants (there will be two equations - 1. for setting the sine component to zero and the other for setting the amplitude of the cosine component to A).

Question

What is the most elegant way to impose this boundary condition in mathematica? I have tried using:

q1sol = FullSimplify[Solve[
{1. a12x q1x Cos[omega x1] - 1. a12y q1y Cos[omega x1] +
1. a22x q2x Cos[omega x1] - 1. a22y q2y Cos[omega x1] +
a32x q3x Cos[omega x1] - a32y q3y Cos[omega x1] ==
A Cos[omega x1], +1. a12y q1x Sin[omega x1] +
1. a12x q1y Sin[omega x1] + 1. a22y q2x Sin[omega x1] +
1. a22x q2y Sin[omega x1] + a32y q3x Sin[omega x1] +
a32x q3y Sin[omega x1] == 0}, {q1x, q1y}]]


which sets the amplitude of cosine to A and sine to zero. This works but just equating the whole function with both sine and cosine terms to $A\cos(\omega x_1)$ did not work. (Mathematica probably could not understand that the amplitude of sine should be set to zero)

• What if you use Chop[] on your last snippet? – J. M.'s technical difficulties Apr 13 '16 at 5:04
• Chop works but as far as I remember it only changes the display. What if I later need to make a plot, won't it ask for the variables q2x and q2y? – zed111 Apr 13 '16 at 5:06
• "works" - then to confirm or disprove your hypothesis of "it only changes the display", have a look at the InputForm[] of the result. – J. M.'s technical difficulties Apr 13 '16 at 5:15
• Oh right, Chop does the job. Thanks. – zed111 Apr 13 '16 at 5:22