Problem 1.
import cmath
# Complex potential function for flow around a cylinder
def complex_potential_cylinder(z, U, a):
return U * (z + (a**2 / z))
def velocity_potential_cylinder(z, U, a):
return complex_potential_cylinder(z, U, a).real
def stream_function_cylinder(z, U, a):
return complex_potential_cylinder(z, U, a).imag
# Inputs
U = float(input("Enter the uniform velocity (U): "))
a = float(input("Enter the radius of the cylinder (a): "))
x = float(input("Enter the x-coordinate: "))
y = float(input("Enter the y-coordinate: "))
z = complex(x, y)
# Calculate and display results
φ_cylinder = velocity_potential_cylinder(z, U, a)
ψ_cylinder = stream_function_cylinder(z, U, a)
print(f"Velocity Potential (φ): {φ_cylinder}")
print(f"Stream Function (ψ): {ψ_cylinder}")