# integral command fails: copy, paste and run. Then exchange m(x,y) and n(x,y) and rerun. I get Maxima error

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)

I have other examples of m(x,y) and n(x,y) that fail

"""

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, sink or neither")

xr(t)=singularity+r*cos(t)

yr(t)=singularity+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")

show("m(x,y)=5*(x-a)/sqrt((x-a)^2+(y-b)^2)")

show("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")

show("domain of atanh.")

show("thank you")

edit retag close merge delete

This the same as

• Using the variable $r$ "as a human" does not mean that maxima or some other symbolic engine also assumes it is a (non-zero) real number.
• sage as many other computer algebra systems is not the solution to all mathematical problems, at least i do not expect so. A good ratio of human interaction is always welcome. So why not help help the machine?
• Never redefine an existing funciton, e.g. integral. (Except you know what you are doing...)