Are you sure about your hand-calculated answer? Let's substitute one simple f(x, y) function into both the answer from Symbolic Math Toolbox and your hand-calculated answer and compare the results. I've run the code you wrote above before running any of these commands.
answer2 = -a*k*sech(k*f(x, y));
subs(yd, f, 0)
subs(xd, f, 0)
The values of xd and yd with this substitution are constants. Therefore so is chid, it has no dependency on x or y. The derivative of a constant should be 0.
What happens when we substitute f(x, y) = 0 into your answer?
As other checks, substituing f(x, y) = x into both d_chid_dx and answer2 gives answers that differ by a factor of a.
>> subs(answer2, f(x, y), x)
ans =
-(a*k)/cosh(k*x)
>> simplify(subs(d_chid_dx, f(x, y), x))
ans(x, y) =
-k/cosh(k*x)
Substituting f(x, y) = y also gives different answers.
>> subs(answer2, f(x, y), y)
ans =
-(a*k)/cosh(k*y)
>> simplify(subs(d_chid_dx, f(x, y), y))
ans(x, y) =
0
For this last check, you're taking the derivative with respect to x of a function that doesn't include x at all so it seems reasonable that the result ought to be 0.
Best Answer