# 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[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")

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("Mathematica's correct answer is: integral=flow=10pisqrt(r^2)")

show("thank you")

This the same as

https://ask.sagemath.org/question/39316/integration/

isn't it?

`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?`integral`

. (Except you know what you are doing...)dan; I do not know how to write the integral that is not evaluated, that is; how to plug in (what is plugged in) into the mix,m(x,y) and n(x,y) terms in the integral command. Mathematica handles the problem and sage does not in the way I wrote the code. I assume my code is at fault ;but do not know where. I lost my Mathematica when I went to a 64 bit machine and too expensive to buy again on SS pension; hence I am learning sage. I am not a mathematician. I am nearly 80 and math is a hobby. So, perhaps I don't know what I am doing. If I did I maybe I would not need 'ask.sagemath

I did not know about reposting. I used no other name. I did not know how to write sage code for predator/model and I came to ask.sagemath and now I know.