Skip to content

Instantly share code, notes, and snippets.

@srmagura
Created December 27, 2014 12:08
Show Gist options
  • Save srmagura/57e877afe43d45c37037 to your computer and use it in GitHub Desktop.
Save srmagura/57e877afe43d45c37037 to your computer and use it in GitHub Desktop.
get_u_reg_expr()
def get_u_reg_expr():
'''
SymPy expression for expected solution to the regularized problem.
'''
k, R, r, th = symbols('k R r th')
a = pi/6
nu = pi / (2*pi - a)
# True solution to original problem
u = besselj(nu/2, k*r) * sin(nu*(th-a)/2)
# Inhomogeneous part of asymptotic expansion
u -= get_u_asympt_expr()
# Compute the shc_coef using quadratures
problem = ShcBesselKnown()
# Homogeneous part of asymptotic expansion
for m in range(1, len(problem.shc_coef)+1):
u -= problem.shc_coef[m-1] * besselj(m*nu, k*r) * sin(m*nu*(th - a))
return u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment