Stephen Moynihan

48 Reputation

2 Badges

18 years, 264 days

MaplePrimes Activity


These are answers submitted by Stephen Moynihan

Sorted - sorry, found out my problem - just needed to simplify the fprintf command to something like: fprintf(fd,"%a %a\n", tt, Zp(tt) ) so that you have: try fd := fopen(file_Zp,'WRITE','TEXT'); for tt from 2 to 3 by 0.0001 do fprintf(fd,"%a %a\n", tt, Zp(tt) ) end do: finally close(file_Zp) end try: I can be quite idiotic sometimes! :-) Cheers
Ok, I've fixed my singularity problem by evaluating my equations slightly away from the singularity - my problem was just in finding out where Maple considered the singularity to 'start' (accounting for its computational error). Turns out Maple thinks the singularity is at 1.00000001 even thought it is located at 1 - fair enough! However, could someone please help me in getting Maple to output what I need in one of my uses of 'try' (it’s the penultimate call to try in the above/attached program): Zp:=r->abs( (DPsi_z(r)+I*omega*Psi_z(r)) / (DPsi_z(r)-I*omega*Psi_z(r)) ); #Open file to print r and Zp to: file_zp:="Z:\\Black Holes\\Maple\\DATA\\Zp_data.txt": try fd := fopen(file_zp,'WRITE','TEXT'); for tttt from 2 to 3 by 0.0005 do fprintf(fd,"%a %a\n",eval([r,Zp(r)],Zp(tttt))[]) #ALSO TRIED fprintf(fd,"%a %a\n",eval(ttt,Zp(ttt)),[]) end do: finally close(file_zp) end try: I get the following error message when I allow the above try loop to run in get2(): Error, (in get2) invalid input: eval received ((22.62979979+8.508037619*6^(1/2))^2+(-27.93968538+6.878295654*6^(1/2))^2)^(1/2)/((22.62979979-8.508037619*6^(1/2))^2+(-27.93968538-6.878295654*6^(1/2))^2)^(1/2), which is not valid for its 2nd argument, eqns All I need is the values of r and Zp (evaluated at those values of r) printed into a txt file for increasing r - but I'm a bit rubbish when it comes to fprint in Maple! I’m sure that all that’s required is a simple alteration to: fprintf(fd,"%a %a\n",eval([r,Zp(r)],Zp(tttt))[]) but I can’t figure out what it is; please help. I tried fprintf(fd,"%a %a\n",ttt,Zp(ttt)) But my program gets into an infinite loop! I've attached a working version of my txt file that gets read into Maple via a read command. Thanks. Download 2660_BH_MP.txt
View file details
-
Not too sure if its what your after, but you could use the assume command. For example: > assume(x>0); > about(x); Originally x, renamed x~: is assumed to be: RealRange(Open(0),infinity)
Thank you very much for your help Joe. The second BC is not zero, although I can see how you thought it might be from the way I phrased the question; I was just evaluating part of the BC at r = 1, not all of it. The other part had to be evaluated a small distance away from r = 1. Sloppiness on my part - sorry about that! I've managed to solve this part of my problem though, with your help. Cheers!
Thanks for your continued help. I'd be interested to see how you got it to work, as I get the following error message upon using your suggested BC: Error, (in DEtools/convertsys) unable to convert to an explicit first-order system here is my code: restart: with(DEtools): infolevel[dsolve]:=4: N:=2: Xi:=1: mu:=0: m:=4: l:=2: sigma:=1: Tau:=0.7: M:=1/(2*(1-(Eta)^2)): a:=Eta: Eta:=Tau*sqrt(2/3): omega:=0.7*m*Eta: g:=r->sqrt((1-2*M/r^(2*N)+2*M*a^2/r^(2*N+2))^(-1)): h:=r->sqrt(r^2*(1+2*M*a^2/r^(2*N+2))): Omega:=r->2*M*a/(r^(2*N+2)+2*M*a^2): f:=r->r/(g(r)*h(r)): V0:=r->f(r)^2*sqrt(h(r))/(r^(N+1))*diff(((f(r)^2)*h(r)/r)*diff(sqrt(h(r))*r^N,r),r): V:=r->V0(r)+f(r)^2*mu^2-(omega-m*Eta)^2+(f(r)^2/(r^2))*(l*(l+2*N)-m^2*(1-(r^2/(h(r)^2)))+4*(1-sigma)*(h(r)^2/(r^2)-1)): YY:=diff(V(r),r): XX:=eval(YY,r=1): alpha1:=diff(g(r)^(-2),r): alpha:=r->alpha1/h(r): x:=r->int(g(r)/f(r),r): ODE:= -f(r)*(g(r)^(-1))*diff(f(r)*(g(r)^(-1))*diff(Phi(r),r),r)+2*I*(omega-m*Eta)*f(r)*(g(r)^(-1))*diff(Phi(r),r)+Phi(r)*(V(r)+(omega-m*Eta)^2)=0: odeadvisor(ODE); #Subject to the BC: BC:=Phi(1)=1, D(Phi)(r) = subs(r=1,(YY*(r-1))/(alpha^2-2*I*alpha*(omega-m*Eta))): #Ask Maple to solve the ODE with respect to Phi(r) as follows: dsol := dsolve({ODE,BC},numeric,Phi(r)): Error, (in kernels) too many levels of recursion dsolve/numeric: entering dsolve/numeric Error, (in DEtools/convertsys) unable to convert to an explicit first-order system I am a bit unsure as to why the odeadvisor now returns that "too many levels of recursion" error as I haven’t changed the ODE. (I am using Maple 8 by the way, if that makes any difference)
Thanks for the quick response. Sorry, I have defined the BC as: Phi(1)=1 D(Phi)(1)= (YY*(r-1))/(alpha^2-2*I*alpha*(omega-m*Eta)): Its just that in an earlier version of this program I had used and alias command to call Phi(1)=Phi_1, and D(Phi)(1)= Phi_p1. Bit of dodgy cutting and pasting on my part from different versions of the program. As for the l(l+2*N) term, your quite right I need * in there so it should read l*(l+2*N). However, even after I have put this in, I still get an error message when I call dsolve: (N.B. infolevel[dsolve]:=4) dsolve/numeric: entering dsolve/numeric DEtools/convertsys: converted to first-order system Y’(x) = f(x,Y(x))namely (with Y' represented by YP) -Maple gives me a massive equation for YP- DEtools/convertsys: correspondence between Y[i] names and original functions: Error, (in dsolve/numeric) invalid specification of initial conditions
Thanks, I'll give it a go. Steve
Page 1 of 1