Multivariable calculus
Divergence of F = (e^x cos y, e^x sin y)
For F(x, y) = (e^x cos y, e^x sin y) the divergence is 2 e^x cos y. Both diagonal partials equal e^x cos y, so the answer is twice one of them. Since e^x is always positive, the sign is the sign of cos y: a source where cos y is positive, a sink where it is negative.
Each partial sees the other factor as a constant multiplier
Both components are a function of times a function of , which is the easiest possible shape for a partial derivative. Whichever variable you are differentiating, the other factor comes along for the ride.
For the first component you differentiate with respect to , so is the constant and is the work. The exponential is its own derivative, so nothing changes at all.
For the second component you differentiate with respect to , so now is the constant and is the work.
The two agree, so the sum doubles: .
The mistake: differentiating both components with respect to x
Because appears in both components, it is tempting to run down the list differentiating with respect to each time. That gives , which is not the divergence of anything you were asked about.
Say the rule out loud as you work: first component with respect to the first variable, second component with respect to the second variable. The variable changes even when the component looks familiar.
A close cousin of this error is a lost minus sign. The derivative of is ; the minus belongs to the derivative of , which never gets used here because only ever sits in the component being differentiated with respect to .
Where the field sources and where it sinks
The factor is positive for every real , so it can change the size of the divergence but never its sign. Everything is decided by .
- For the divergence is positive: a source.
- For it is negative: a sink.
- On the lines it is exactly zero, and those horizontal lines separate the bands.
One sign change makes the whole picture different. The nearby field has divergence everywhere, because flipping the second component flips the sign of the second partial. That version is incompressible; this one is not.
Checked on every build: each component is differentiated numerically with respect to its own variable, and the sum is compared against the divergence above at six sample points.
Frequently asked questions
Why does the exponential factor survive into the answer unchanged?
Because is its own derivative. Differentiating the first component with respect to leaves it alone, and differentiating the second with respect to never touches it.
For which y is the divergence negative?
Wherever , that is for and every shift of that band by . The value of scales the size but never flips the sign.