Skip to content
DeepForgeby svx
All problems
HardCalculusca-184

Conjugate Harmonic Function

Problem

The function u(x, y) = a*x^2 - a*y^2 + b*x*y is harmonic for every a, b. Its harmonic conjugate, normalized by v(0, 0) = 0, is

v(x, y) = 2*a*x*y + (b/2)*(y^2 - x^2)

Given a, b, x, and y, return v(x, y). Then u + i*v is holomorphic.

Hint

Integrate v_x = -u_y with respect to y and fix the integration constant with v_y = u_x.

Test cases

case 1
in: [1,0,1,1]
expected: 2
case 2
in: [1,2,1,0]
expected: -1
case 3
in: [2,0,0,3]
expected: 0
case 4
in: [0,4,2,1]
expected: -6
Starter codePython
def conjugate_harmonic(a, b, x, y):
    # Your code here
    pass

4 test cases · run your code against them in the editor