nm

11558 Reputation

20 Badges

13 years, 135 days

MaplePrimes Activity


These are answers submitted by nm

It makes it easier if you replace  by say A before.

restart;	
s1 := Ls*cos(omega*t + phi__l + theta)*omega + sin(omega*t + phi__l + theta)*Rs;
s2 := sqrt((omega*Ls)^2+Rs^2)*sin(omega*t + phi__l + theta + arctan(omega*Ls/Rs));
s1:=subs(omega*t + phi__l + theta=A,s1):
s2:=algsubs(omega*t + phi__l + theta=A,s2):	

And now

s2:=simplify(expand(s2)) assuming positive:
evalb(s2=s1)

                true

You can also replace the above by

s2:=simplify(expand(s2),symbolic);
evalb(s2=s1)

            true

another option, if you want to do it more manualy

restart;
roll_col_1:=rand(10..20):
roll_col_2:=rand(50..100):
col_1:= Vector([seq(roll_col_1(),i=1..6)]);
col_2:= Vector([seq(roll_col_2(),i=1..6)]);
A:=<col_1|col_2>

You need to be careful which convention to use for spherical coordinates. There is the Physics one and there is the mathematics one. See https://en.wikipedia.org/wiki/Spherical_coordinate_system

Using the Physics one (more common)

evalf(int(int(int(ln(r^2 + theta^2 + phi^2 +1),r=0..2),theta=-Pi/2..Pi/2),phi=0..2*Pi))

97.2256142300

Using the math convention for the angles

evalf(int(int(int(ln(r^2 + theta^2 + phi^2 +1),r=0..2),theta=0..2*Pi),phi=-Pi/2..Pi/2))

97.2256142300

if you use 0..Pi instead of -Pi/2..Pi/2 you get

evalf(int(int(int(ln(r^2 + theta^2 + phi^2 +1),r=0..2),theta=0..2*Pi),phi=0..Pi))

105.5237634000

Not sure which convention you want. Wikepida page above describes these more.

ps. only numerical integration worked in Maple. 

 

 

restart;
ode:=diff(y(x),x)+k*piecewise(y(x)>=0,y(x),y(x)<0,0) =sin(x);
dsolve(ode)

Can't solve it analytically. You can solve this nuemrically only

 

restart;
k:=1;
ode:=diff(y(x),x)+k*piecewise(y(x)>=0,y(x),y(x)<0,0) =sin(x);
sol:=dsolve([ode,y(0)=1],numeric)

Maple used to have many of these cases, but it got better over years handling them.

A trick to bypass this issue, is to delay the substitution of the actual function until after you obtained the series solution. As follows.

Using a generic f(x,y) first, then this function is replaced by the actual value of the function after the series solution is obtained. This makes life much easier for Maple pdsolve.
 

 

restart;

interface(version);

`Standard Worksheet Interface, Maple 2020.1, Windows 10, July 30 2020 Build ID 1482634`

pde := diff(u(x,y,t),t,t) = diff(u(x,y,t),x,x) + diff(u(x,y,t),y,y);
bc := u(x,0,t)=0, u(x,1,t)=0, u(0,y,t)=0, u(1,y,t)=0;
ic := u(x,y,0) =f(x,y),  D[3](u)(x,y,0)=0;
sol := pdsolve({pde, bc, ic});
my_actual_function :=x*y*sin(Pi*x)*sin(Pi*y);
sol:=eval(sol, [infinity=4,f(x,y)=my_actual_function]);

diff(diff(u(x, y, t), t), t) = diff(diff(u(x, y, t), x), x)+diff(diff(u(x, y, t), y), y)

u(x, 0, t) = 0, u(x, 1, t) = 0, u(0, y, t) = 0, u(1, y, t) = 0

u(x, y, 0) = f(x, y), (D[3](u))(x, y, 0) = 0

u(x, y, t) = Sum(Sum(4*sin(n*Pi*x)*sin(n1*Pi*y)*cos(Pi*(n^2+n1^2)^(1/2)*t)*(Int(sin(n1*Pi*y)*(Int(sin(n*Pi*x)*f(x, y), x = 0 .. 1, AllSolutions)), y = 0 .. 1, AllSolutions)), n = 1 .. infinity), n1 = 1 .. infinity)

x*y*sin(Pi*x)*sin(Pi*y)

u(x, y, t) = Sum(Sum(4*sin(n*Pi*x)*sin(n1*Pi*y)*cos(Pi*(n^2+n1^2)^(1/2)*t)*(Int(sin(n1*Pi*y)*(Int(sin(n*Pi*x)*x*y*sin(Pi*x)*sin(Pi*y), x = 0 .. 1, AllSolutions)), y = 0 .. 1, AllSolutions)), n = 1 .. 4), n1 = 1 .. 4)

#now it works        
value(sol)

u(x, y, t) = (1/900)*(225*Pi^2*sin(Pi*x)*sin(Pi*y)*cos(Pi*2^(1/2)*t)-1600*sin(Pi*y)*cos(5^(1/2)*Pi*t)*sin(Pi*x)*cos(Pi*x)-512*sin(Pi*y)*cos(17^(1/2)*Pi*t)*sin(Pi*x)*cos(Pi*x)^3+256*sin(Pi*y)*cos(17^(1/2)*Pi*t)*sin(Pi*x)*cos(Pi*x))/Pi^2-(8/9)*sin(Pi*x)*sin(2*Pi*y)*cos(5^(1/2)*Pi*t)/Pi^2+(256/81)*sin(2*Pi*x)*sin(2*Pi*y)*cos(Pi*8^(1/2)*t)/Pi^4+(512/2025)*sin(4*Pi*x)*sin(2*Pi*y)*cos(Pi*20^(1/2)*t)/Pi^4-(16/225)*sin(Pi*x)*sin(4*Pi*y)*cos(17^(1/2)*Pi*t)/Pi^2+(512/2025)*sin(2*Pi*x)*sin(4*Pi*y)*cos(Pi*20^(1/2)*t)/Pi^4+(1024/50625)*sin(4*Pi*x)*sin(4*Pi*y)*cos(Pi*32^(1/2)*t)/Pi^4

 


 

Download pdsolve.mw

Looking at Wikipeida, it looks like you used different formula. The formula with the origin at center is

You wrote

Where the eccentricity you used is 0.25.

Fixing this, and increasing e, you get ellipse.

e:=0.25; b:=1;
p1:=plot(b/sqrt(1- (e*cos(theta))^2), theta = 0 .. 2*Pi, coords = polar, scaling = constrained,color=red):
e:=0.75;
p2:=plot(b/sqrt(1- (e*cos(theta))^2), theta = 0 .. 2*Pi, coords = polar, scaling = constrained,color=blue):

plots:-display([p1,p2])

Try this. Need to use := and not = for assignment. And why write 1.  instead of just 1 ? This is not Matlab. If you want real numbers, you could always convert the final answer to float, and it is more accurate this way.

 

restart;

H := proc(n::integer)::real; 
   local s, i; 
   s := 0; 
   for i by 2 to n do 
       if i <= n - 1 then 
          s := s + 1/(i*(i + 1)); 
       else 
          s := s + 1/i; 
       end if; 
   end do; 
   return s;
end proc;

A := proc(n::integer, T::procedure)::real; 
       local d1, d2, s; 
       d1 := T(n + 1) - T(n); 
       d2 := T(n + 2) - T(n); 
       s := T(n + 1) - d1*d2/(d2 - d1); 
       return s; 
end proc;

I have not used spacecurve before in Maple, but looking at help, I think you need to do this.

restart;
f:=(x,y)->2*x^2+3*y^2-x*y-6;
subs([x=1,y=1],diff(f(x,y),x));
subs([x=1,y=1],diff(f(x,y),y));
p1:=plot3d(f(x,y),style=patchcontour):
p2:=plots:-spacecurve([x,1,f(x,1)],x=-10..10):
p3:=plots:-spacecurve([1,y,f(1,y)],y=-10..10):
plots:-display([p1,p2,p3])

May be you want is map. Hard to guess without an example. Maple will add the "()" automatically for you.

f:=poly->poly+1; #this is your f function, change as needed
my_polynomials:=[2*x-1,x^2+3*x+2,x^3-2*x-3,x^3];
map(f,my_polynomials)

 

alternative:

I happen to like pattern matching also. Even though in Maple this is not as needed/ or used as it is in Mathematica.

So you could also do

unassign('a,b');
Given_eq_3_37a := simplify(subs([Given_eq_3_30], Given_eq_3_37));

patmatch(rhs(Given_eq_3_37a),sqrt(a::anything)*sqrt(b::anything),'la');
assign(la);

Given_eq_3_37a:=M=sqrt(a*b)

this is similar to you question you asked above.  

First the solution to the PDE is sol := u(x, t) = 2*x

so nothing to animate, since it has no time depenedency.

But if you change the command to

plots:-animate(plot, [rhs(sol), x = 0 .. 2], t = 0 .. 1, frames = 60)

The error goes away. but nothing will move in the animation ofcourse since there is no t in the solution.

 

 

Change the animation line to the following makes it work:

plots[animate](plot, [subs(t=i,rhs(sol)), x = -10 .. 10], i = 0 .. 5,frames=100)

ps. I see it will also works without the extra subs() in there.

 

restart;
pde := diff(u(x,t), t) = diff(u(x,t),x$2) - alpha*u(x,t);
bc  := u(0,t) = 0, u(L,t) = 0;
pdsolve([pde, bc],u(x,t)) assuming alpha>0,L>0;

start edit: fyi, the above was done on Physics version earlier than 824. In Latest version 824, the output looks like

end edit.

 

But it would be better if you provide IC:

restart;
pde := diff(u(x,t), t) = diff(u(x,t),x$2) - alpha*u(x,t);
bc  := u(0,t) = 0, u(L,t) = 0;
ic  := u(x,0) = f(x);
pdsolve([pde, bc, ic],u(x,t)) assuming alpha>0,L>0;

 

Updated to answer new comment:

can you provide the working process without Maple command if possible

I assume you mean solution by hand not using Maple? if so, you can use separation of variables.

But this forum is really about using Maple commands to solve problems. But here is my hand solution anyway. This is from one of my old solutions. I solved hundreds of such PDE's by hand before. This shows Maple's solution was correct also as it got same final answer ;).

Ofcourse using Maple is much easier than having to do all this each time.

 

 

 

Need to set the right condition. For exp(t), the condition is s-1>0. For general exp(a*t) the condition is s-a>0. 

restart;

LT := proc(f::function,t::symbol,s::symbol)
local a,la;
patmatch(op(1,f),a::anything*t,'la');
assign(la);
simplify(int(exp(-s*t)*f, t = 0 .. infinity), assume=[s-a>0]);
end proc:

LT(exp(t),t,s);
LT(exp(2*t),t,s);
LT(exp(a*t),t,s);

1/(-1+s)

1/(-2+s)

-1/(a-s)

inttrans:-laplace(exp(t),t,s);
inttrans:-laplace(exp(2*t),t,s);
inttrans:-laplace(exp(a*t),t,s);

1/(-1+s)

1/(-2+s)

1/(-a+s)

 


 

Download lap.mw

in addition to what was said in other replies.

The issues seems that Maple could not integrate 

Using another software, this has antiderivative

Copying this result to Maple to give final solution and odetest gives zero. Here is the worksheet


 

restart;

with(MmaTranslator);
ode:=diff(Q(t),t)=-alpha*beta*t^(beta-1)*Q(t)-a*p^(-b);
sol:=dsolve(ode);

[FromMma, FromMmaNotebook, Mma, MmaToMaple]

diff(Q(t), t) = -alpha*beta*t^(beta-1)*Q(t)-a*p^(-b)

Q(t) = (Int(-a*p^(-b)*exp(t^beta*alpha), t)+_C1)*exp(-t^beta*alpha)

#the above is same as
sol := Q(t) = (( -a*p^(-b)*Int(exp(t^beta*alpha), t)) + _C1)*exp(-t^beta*alpha)

Q(t) = (-a*p^(-b)*(Int(exp(t^beta*alpha), t))+_C1)*exp(-t^beta*alpha)

int(exp(t^beta*alpha), t)

int(exp(t^beta*alpha), t)

#copied antiderivative of the above
inside_integral:=FromMma(`-((t*Gamma[beta^(-1), -(alpha*(t^beta))])/(beta*(-(alpha*(t^beta)))^(beta^(-1))))`);

-t*GAMMA(1/beta, -t^beta*alpha)/(beta*(-t^beta*alpha)^(1/beta))

#this is the final solution
sol:=subs(Int(exp(t^beta*alpha), t)=inside_integral,sol)

Q(t) = (a*p^(-b)*t*GAMMA(1/beta, -t^beta*alpha)/(beta*(-t^beta*alpha)^(1/beta))+_C1)*exp(-t^beta*alpha)

odetest(sol,ode)

0

 


 

Download dsolve_9_5_2020.mw

 

First 10 11 12 13 14 15 16 Page 12 of 19