Ceryn

5 Reputation

5 Badges

14 years, 73 days

MaplePrimes Activity


These are replies submitted by Ceryn

As I said by creating another topic (sorry about that), thanks for the help.

I am now facing another problem.

 

I managed to solve my equations, and wrote a procedure to find the good values of my b1 and b2 parameters for any a value, with respect with those other boundary conditions :

 

findParams:=proc(a)::list;
 local valFx2,valNx2,i,err1;
 global b1,b2,x,x1,x2,f0,df0,u0,n0,f1,f_1,u1,n1,DN,Du,DDF,F,u,N,dsys,dsoln;
b1:=-1;
b2:=1;
x1:=0.001;
x2:=5000;

DN:=diff(N(x),x)=a/4*(x+8*(sin(F(x)))^2/x)*N(x)*diff(F(x),x)^2;
Du:=diff(u(x),x)=a/8*((x^2+8*(sin(F(x)))^2)*(1-2*u(x)/x)*diff(F(x),x)^2+2*(sin(F(x)))^2+4*(sin(F(x)))^4/x^2);
DDF:=diff(F(x),x$2)=1/(N(x)*(1-2*u(x)/x)*(x^2+8*(sin(F(x)))^2))*(-(x^2+8*(sin(F(x)))^2)*diff(N(x),x)*(1-2*u(x)/x)*diff(F(x),x)+(1+4*(sin(F(x)))^2/x^2+4*(1-2*u(x)/x)*diff(F(x),x)^2)*N(x)*sin(2*F(x))-2*(x+4*sin(2*F(x))*diff(F(x),x))*N(x)*(1-2*u(x)/x)*diff(F(x),x)-2*(1+8*(sin(F(x)))^2/x^2)*(u(x)-diff(u(x),x)*x)*N(x)*diff(F(x),x));

valFx2:=1;
i:=0;
err1:=0.000001;

while (abs(valFx2)>err1) do
 f0(x):=Pi+b1*x;
 df0(x):=diff(f0(x),x);
 u0(x):=a/8*b1^2*(1+4*b1^2)*x^3;
 n0(x):=b2+a/8*b1^2*b2(1+8*b1^2)*x^2;
 f1:=eval(f0(x),x=x1);
 f_1:=eval(df0(x),x=x1);
 u1:=eval(u0(x),x=x1);
 n1:=eval(n0(x),x=x1);
 dsys:={DN,Du,DDF,F(x1)=f1,u(x1)=u1,N(x1)=n1,D(F)(x1)=f_1};
 dsoln:=dsolve(dsys,numeric);
 valFx2:=eval(F(x),dsoln(x2));
 
 if (abs(valFx2)>err1) then
  if (valFx2<0) then
   b1:=b1+(0.5)^i;
  else
   b1:=b1-(0.5)^i;
  end if;
  i:=i+1;
 end if;
end do;

valNx2:=2;
i:=1;

while (abs(valNx2-1)>err1) do
 f0(x):=Pi+b1*x;
 df0(x):=diff(f0(x),x);
 u0(x):=a/8*b1^2*(1+4*b1^2)*x^3;
 n0(x):=b2+a/8*b1^2*b2(1+8*b1^2)*x^2;
 f1:=eval(f0(x),x=x1);
 f_1:=eval(df0(x),x=x1);
 u1:=eval(u0(x),x=x1);
 n1:=eval(n0(x),x=x1);
 dsys:={DN,Du,DDF,F(x1)=f1,u(x1)=u1,N(x1)=n1,D(F)(x1)=f_1};
 dsoln:=dsolve(dsys,numeric);
 valNx2:=eval(N(x),dsoln(x2));

 if (abs(valNx2-1)>err1) then
  if (valNx2<1) then
   b2:=b2+(0.5)^i;
  else
   b2:=b2-(0.5)^i;
  end if;
  i:=i+1;
 end if;
end do;
dsoln:=dsolve(dsys,numeric,output=listprocedure);
return dsoln,b1,b2;
end proc;

 

which gives me the solution to my system, or at least, a list of procedures which can return single values (for 0<a<0.149). However, I need to evaluate the integral :

m000:=4*Pi*int((1/8*((1-2*u(x)/x)*(D(F)(x))^2+2*(sin(F(x)))^2/x^2)+(sin(F(x)))^2/2/x^2*(2*(1-2*u(x)/x)*(D(F)(x))^2+((sin(F(x)))^2/x^2))*N(x)*x^2,x1..10,numeric=true));

where I defined

x:=evalf(rhs(a000[1][1]));

F(x):=evalf(rhs(a000[1][2]));

D(F)(x):=evalf(rhs(a000[1][3]));

N(x):=evalf(rhs(a000[1][4]));

u(x):=evalf(rhs(a000[1][5]));

I receive the following error :

Error, invalid input: sin expects its 1st argument, x, to be of type algebraic, but received proc (x) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 < nargs then error "invalid input: too many arguments" end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x) else _xout := evalf(x) end if; _dat := eval(`dsolve/numeric/data/modules`[101]); _solnproc := _dat:-Get("soln_procedure"); _pars := map(rhs, _dat:-Get("params")); if not type(_xout, 'numeric') then if member(x, ["start", 'start', "...

 

The problem seems to be that Maple doesnt recognize the procedures as functions of x. Is there any way to define such functions from the procedures dsolve returns, or maybe from another dsolve output? Since the procedures return an evaluation of the system at a single point, is it possible to evaluate the integral, since its evaluation requires a knowledge of all points?

 

I also tried to integrate

int(rhs(a000[1][2]),x1..500,numeric=true);

which worked, and

m000:=4*Pi*int((1/8*((1-2*u(x)/x)*(D(F)(x))^2+2*(F(x))^2/x^2)+(F(x))^2/2/x^2*(2*(1-2*u(x)/x)*(D(F)(x))^2+(F(x)^2/x^2))*N(x)*x^2,x1..10,numeric=true));

which did not (I removed the sin from the above equation, to see if it worked). So it looks like there are more than one problem with this, as the removal of the sin just returns the unevaluated integral. Am I asking too much of Maple?

 

Thanks for any help, and thank you again for your last answer!

As I said by creating another topic (sorry about that), thanks for the help.

I am now facing another problem.

 

I managed to solve my equations, and wrote a procedure to find the good values of my b1 and b2 parameters for any a value, with respect with those other boundary conditions :

 

findParams:=proc(a)::list;
 local valFx2,valNx2,i,err1;
 global b1,b2,x,x1,x2,f0,df0,u0,n0,f1,f_1,u1,n1,DN,Du,DDF,F,u,N,dsys,dsoln;
b1:=-1;
b2:=1;
x1:=0.001;
x2:=5000;

DN:=diff(N(x),x)=a/4*(x+8*(sin(F(x)))^2/x)*N(x)*diff(F(x),x)^2;
Du:=diff(u(x),x)=a/8*((x^2+8*(sin(F(x)))^2)*(1-2*u(x)/x)*diff(F(x),x)^2+2*(sin(F(x)))^2+4*(sin(F(x)))^4/x^2);
DDF:=diff(F(x),x$2)=1/(N(x)*(1-2*u(x)/x)*(x^2+8*(sin(F(x)))^2))*(-(x^2+8*(sin(F(x)))^2)*diff(N(x),x)*(1-2*u(x)/x)*diff(F(x),x)+(1+4*(sin(F(x)))^2/x^2+4*(1-2*u(x)/x)*diff(F(x),x)^2)*N(x)*sin(2*F(x))-2*(x+4*sin(2*F(x))*diff(F(x),x))*N(x)*(1-2*u(x)/x)*diff(F(x),x)-2*(1+8*(sin(F(x)))^2/x^2)*(u(x)-diff(u(x),x)*x)*N(x)*diff(F(x),x));

valFx2:=1;
i:=0;
err1:=0.000001;

while (abs(valFx2)>err1) do
 f0(x):=Pi+b1*x;
 df0(x):=diff(f0(x),x);
 u0(x):=a/8*b1^2*(1+4*b1^2)*x^3;
 n0(x):=b2+a/8*b1^2*b2(1+8*b1^2)*x^2;
 f1:=eval(f0(x),x=x1);
 f_1:=eval(df0(x),x=x1);
 u1:=eval(u0(x),x=x1);
 n1:=eval(n0(x),x=x1);
 dsys:={DN,Du,DDF,F(x1)=f1,u(x1)=u1,N(x1)=n1,D(F)(x1)=f_1};
 dsoln:=dsolve(dsys,numeric);
 valFx2:=eval(F(x),dsoln(x2));
 
 if (abs(valFx2)>err1) then
  if (valFx2<0) then
   b1:=b1+(0.5)^i;
  else
   b1:=b1-(0.5)^i;
  end if;
  i:=i+1;
 end if;
end do;

valNx2:=2;
i:=1;

while (abs(valNx2-1)>err1) do
 f0(x):=Pi+b1*x;
 df0(x):=diff(f0(x),x);
 u0(x):=a/8*b1^2*(1+4*b1^2)*x^3;
 n0(x):=b2+a/8*b1^2*b2(1+8*b1^2)*x^2;
 f1:=eval(f0(x),x=x1);
 f_1:=eval(df0(x),x=x1);
 u1:=eval(u0(x),x=x1);
 n1:=eval(n0(x),x=x1);
 dsys:={DN,Du,DDF,F(x1)=f1,u(x1)=u1,N(x1)=n1,D(F)(x1)=f_1};
 dsoln:=dsolve(dsys,numeric);
 valNx2:=eval(N(x),dsoln(x2));

 if (abs(valNx2-1)>err1) then
  if (valNx2<1) then
   b2:=b2+(0.5)^i;
  else
   b2:=b2-(0.5)^i;
  end if;
  i:=i+1;
 end if;
end do;
dsoln:=dsolve(dsys,numeric,output=listprocedure);
return dsoln,b1,b2;
end proc;

 

which gives me the solution to my system, or at least, a list of procedures which can return single values (for 0<a<0.149). However, I need to evaluate the integral :

m000:=4*Pi*int((1/8*((1-2*u(x)/x)*(D(F)(x))^2+2*(sin(F(x)))^2/x^2)+(sin(F(x)))^2/2/x^2*(2*(1-2*u(x)/x)*(D(F)(x))^2+((sin(F(x)))^2/x^2))*N(x)*x^2,x1..10,numeric=true));

where I defined

x:=evalf(rhs(a000[1][1]));

F(x):=evalf(rhs(a000[1][2]));

D(F)(x):=evalf(rhs(a000[1][3]));

N(x):=evalf(rhs(a000[1][4]));

u(x):=evalf(rhs(a000[1][5]));

I receive the following error :

Error, invalid input: sin expects its 1st argument, x, to be of type algebraic, but received proc (x) local _res, _dat, _solnproc, _xout, _ndsol, _pars, _i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; if 1 < nargs then error "invalid input: too many arguments" end if; _EnvDSNumericSaveDigits := Digits; Digits := 15; if _EnvInFsolve = true then _xout := evalf[_EnvDSNumericSaveDigits](x) else _xout := evalf(x) end if; _dat := eval(`dsolve/numeric/data/modules`[101]); _solnproc := _dat:-Get("soln_procedure"); _pars := map(rhs, _dat:-Get("params")); if not type(_xout, 'numeric') then if member(x, ["start", 'start', "...

 

The problem seems to be that Maple doesnt recognize the procedures as functions of x. Is there any way to define such functions from the procedures dsolve returns, or maybe from another dsolve output? Since the procedures return an evaluation of the system at a single point, is it possible to evaluate the integral, since its evaluation requires a knowledge of all points?

 

I also tried to integrate

int(rhs(a000[1][2]),x1..500,numeric=true);

which worked, and

m000:=4*Pi*int((1/8*((1-2*u(x)/x)*(D(F)(x))^2+2*(F(x))^2/x^2)+(F(x))^2/2/x^2*(2*(1-2*u(x)/x)*(D(F)(x))^2+(F(x)^2/x^2))*N(x)*x^2,x1..10,numeric=true));

which did not (I removed the sin from the above equation, to see if it worked). So it looks like there are more than one problem with this, as the removal of the sin just returns the unevaluated integral. Am I asking too much of Maple?

 

Thanks for any help, and thank you again for your last answer!

Page 1 of 1