show("G.2.a singularity across sinks and swirls from Mathematica Text")
show("second try to enter workable code that can be copied, pasted and run")
var('y a b q t r')
m(x,y)=q*(x-a)/((x-a)^2+(y-b)^2)
n(x,y)=q*(y-b)/((x-a)^2+(y-b)^2)
""" replacments get Maxima error in integrate command
m(x,y)=5*(x-a)/sqrt((x-a)^2+(y-b)^2)
n(x,y)=5*(y-b)/sqrt((x-a)^2+(y-b)^2)
"""
show("n(x,y)=",n(x,y))
show("Field(x,y)=(m(x,y),n(x,y))")
Field=(m(x,y),n(x,y))
show("Field=",Field)
singularity=(a,b)
show("singularity=(a,b), when a==x and b==y")
show("----------------")
show("constructing small circle centered at singularity (a,b) with radius 'r'")
show("aiming to determine if the singularity is a source of flow, as sink or neither")
xr(t)=singularity[0]+r*cos(t)
yr(t)=singularity[1]+r*sin(t)
show("xr(t)=",xr(t))
show("yr(t)=",yr(t))
xrprime(t)=diff(xr(t),t)
yrprime(t)=diff(yr(t),t)
show("xrprime(t)=",xrprime(t)," = derivative(xr(t),t)")
show("yrprime(t)=",yrprime(t)," = derivative(yr(t),t)")
show("----------------")
show("measure flow across the circle surrounding the singularity")
show("integral=integral(-n(xr(t),yr(t))xrprime(t)+m(xr(t),yr(t))yrprime(t),(t,0,2*pi))")
integral=integral(-n(xr(t),yr(t))xrprime(t)+m(xr(t),yr(t))yrprime(t),(t,0,2*pi))
show("integral=",integral)
show("q>0 then singularity at (a,b) is a source of flow ")
show("q<0 then singularity at (a,b) is a sink for flow")
show("q=0 then no net flow at singularity (a,b)")
show("----------------")
show("now try to run the above with the replacement m(x,y), n(x,y) :")
show("I get an error in Maxima, see below")
show("these m(x,y) and n(x,y) do not work for me")
m(x,y)=5*(x-a)/sqrt((x-a)^2+(y-b)^2)
n(x,y)=5*(y-b)/sqrt((x-a)^2+(y-b)^2)
show("In sage I get RuntimeError: ECL says: Error executing code in Maxima: atanh: argument 1 isn't in the domain of atanh.")
show("Mathematica's correct answer is: integral=flow=10pisqrt(r^2)")