Ask Your Question

meirsamel's profile - activity

2017-12-05 11:34:10 +0200 received badge  Student (source)
2017-12-05 06:58:15 +0200 asked a question svd is here a sage command to reverse the SVD, that ia restore the original matrix?

SVD matrix analysis

2017-10-29 19:52:43 +0200 commented question integral command fails: copy, paste and run. Then exchange m(x,y) and n(x,y) and rerun. I get Maxima error

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.

2017-10-29 19:47:05 +0200 commented question integral command fails: copy, paste and run. Then exchange m(x,y) and n(x,y) and rerun. I get Maxima error

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

2017-10-29 19:11:27 +0200 commented question integral fails entering code below. Hopefully I'll avoid typos

thank you. I submitted another version with your instructions

2017-10-29 18:42:10 +0200 received badge  Associate Editor (source)
2017-10-29 17:54:06 +0200 asked a question 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")

2017-10-29 16:48:11 +0200 asked a question retry at the integration: copy and paste

show("I hope that now you can copy and paste")

show("G.2.a singularity across sinks and swirls from mathematica text")

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)

"""

replace m(x,y and n(x,y) above with the entries just below and rerun to see the error in Maxima

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)

the error occurs in the line" 'integral=integral(-n(xr(t),yr(t))xrprime(t)+m(xr(t),yr(t))yrprime(t),(t,0,2*pi))'

there are other examples of m(x,y) and n(x,y) that also fail in the integration command

"""

show("n(x,y)=",n(x,y))

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 test the singularity. Is the singularity a source of flow, a 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))")

show("and the integral command fails in Maxima when m(x,y) and n(x,y) are replaced with the other m(x,y), n(x,y)")

show("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) above. The error in Maxima comes up:")

show("in the line integral=integral(-n(xr(t),yr(t))xrprime(t)+m(xr(t),yr(t))yrprime(t),(t,0,2*pi))")

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

show("atanh.")

show("Mathematica's correct answer is: integral=flow at singularity=10pisqrt(r^2)")

show("Mathematica's correct answer is: integral=flow at singularity=10pisqrt(r^2)")

show("hence in the limit r->0 there is no flow at the singularity and the singularity is neither a source nor a sink")

show("thank you for your help")

show("Meir")

2017-10-29 14:56:40 +0200 asked a question integral fails entering code below. Hopefully I'll avoid typos

Here is the code:

show("taken from Mahtematica")
show("G.2.a.singularity")
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)
#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)
2017-10-29 14:42:25 +0200 commented question integration

Thank you. I'll try again

2017-10-29 02:38:01 +0200 received badge  Editor (source)
2017-10-29 02:29:56 +0200 asked a question integration

show("G.2.a singularity across sinks and swirls") show("copy and paste the preview text and ignore the rest") show("then remove leading '#' in line 5 and 6 and rerun with error") show("runs in mathematica and is from a mathematica text") show("other examples where maxima fails") 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)

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("m(x,y)=",m(x,y)) 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'") xr(t)=singularity[0]+rcos(t) yr(t)=singularity[1]+rsin(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,2pi))") integral=integral(-n(xr(t),yr(t))xrprime(t)+m(xr(t),yr(t))yrprime(t),(t,0,2pi)) show("integral=",integral) show("the integral is 2piq") 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 m(x,y), n(x,y) below:") show("just remove leading '#' in lines 5 and 6") show("does 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)") and b==y")

2017-09-18 18:48:49 +0200 commented answer solution to logistic differential y'=r*y*(1-y)/b

dan_fulea: Thank you. Solved my problem/question. I am a senior (very) not a student. Math is my hobby. My mathematica version does not run on a 64 bit machine and therefore, switching to sage and learning on my own with the help of a few texts books. I have not seen/learned the code "sol.subs({y(x):z}).solve(z,to_poly_solve=True)[0].rhs() in any of my text books. After your help I found with 'solve? evaluate' but no explanation as to why. A bit exotic for my level. The code fixes my problem. Thanks again. כול הכבוד

P.S. I miss-typed my original questions. Meant to write (1-y/b); not (1-y)/b. That error caused some unecessary confusion.

2017-09-18 01:46:48 +0200 commented answer solution to logistic differential y'=r*y*(1-y)/b

re:logistic function If I understand your reply correctly, y(x)=3e^(2/75x)/(3e^(2/75x) - 1) But y(x)=3e^(2/75x)/(3e^(2/75x) - 1) is not a logistic function Plot it out and plot out y(x)=(bexp(rx)y0)/(exp(rx)*y0-y0+b) Again thank you for responding.

2017-09-18 01:46:48 +0200 commented answer solution to logistic differential y'=r*y*(1-y)/b

let me study this. thank you

2017-09-15 22:31:31 +0200 asked a question solution to logistic differential y'=r*y*(1-y)/b

How to solve this logistic differential in sage?

y=function('y')(x)
(b,r,y0)=(30,0.8,1.5)
de=diff(y,x)==r*y*((1-y)/b) # logistic equation
soln=desolve(de,y,ics=[0,y0])

mathematica solution is: y(x)=(b*exp(r*x)*y0)/(exp(r*x)*y0-y0+b)

Other questions/answers found on the logistic topic were not helpful for this problem