Kitonum

15182 Reputation

24 Badges

12 years, 68 days

MaplePrimes Activity


These are answers submitted by Kitonum

In the help for  fsolve  we see  
"variables - (optional) name or set(name); unknowns for which to solve"

So use  x0  and  y0  instead (for example).


 

restart;

x%*x;

`%*`(x, x)

(1)

value(%);

x^2

(2)

 


 

Download inert.mw

restart;         
plot3d(eval([x,y,4*x^2+9*y^2],[x=1/2*r*cos(t),y=1/3*r*sin(t)]), r=0..1, t=0..2*Pi, axes=normal, scaling=constrained);


 

Download _paraboloid.mw

Use  LinearAlgebra:-GenerateMatrix  instead of  linalg:-genmatrix :

 

Download sys.mw

In Maple the imaginary unit should be coded as  I  not  :


 

restart;
with(LinearAlgebra):
with(plots, implicitplot):
i:=I:
M := Matrix([[sigma + Gamma*i*k + 0.5 + 0.5*tanh(c - v) + beta*v, -0.5 + 0.5*tanh(c - v), 0.5*(w - u)*sech^2*(c - v) - beta*u], [-0.5 - 0.5*tanh(c - v), sigma - i*k*Gamma + 0.5 + 0.5*tanh(c - v) + beta*v, 0.5*(u - w)*sech^2*(c - v) - beta*w], [-beta*v, -beta*v, sigma - beta*alpha*(u + w)]]);

Matrix(3, 3, {(1, 1) = sigma+I*GAMMA*k+.5+.5*tanh(c-v)+beta*v, (1, 2) = -.5+.5*tanh(c-v), (1, 3) = (.5*w-.5*u)*sech^2*(c-v)-beta*u, (2, 1) = -.5-.5*tanh(c-v), (2, 2) = sigma-I*GAMMA*k+.5+.5*tanh(c-v)+beta*v, (2, 3) = (.5*u-.5*w)*sech^2*(c-v)-beta*w, (3, 1) = -beta*v, (3, 2) = -beta*v, (3, 3) = sigma-beta*alpha*(u+w)})

(1)

Eq := Determinant(M);

.50*tanh(c-v)*sigma+1.0*tanh(c-v)*sigma^2+.50*tanh(c-v)^2*sigma+1.0*sigma^2+sigma^3-1.0*sigma*tanh(c-v)*beta*alpha*u-1.0*sigma*tanh(c-v)*beta*alpha*w-1.0*tanh(c-v)*beta^2*v*alpha*u-1.0*tanh(c-v)*beta^2*v*alpha*w+.50*tanh(c-v)*beta*v^2*sech^2*u-.50*tanh(c-v)*beta*v^2*sech^2*w-Gamma^2*k^2*beta*alpha*u-Gamma^2*k^2*beta*alpha*w-2*sigma*beta^2*v*alpha*u-2*sigma*beta^2*v*alpha*w+Gamma^2*k^2*sigma+beta^2*v^2*sigma+2*beta*v*sigma^2+1.0*beta*v*sigma-1.0*beta^2*v*w-beta^3*v^2*u-1.0*beta^2*v*u-beta^3*v^2*w-(1.0*I)*Gamma*k*beta*v*c*sech^2*w+(1.0*I)*Gamma*k*beta*v*c*sech^2*u-beta^2*v*u*sigma-.50*tanh(c-v)*beta*alpha*u-.50*tanh(c-v)*beta*alpha*w-.50*tanh(c-v)^2*beta*alpha*u-.50*tanh(c-v)^2*beta*alpha*w+1.0*tanh(c-v)*beta*v*sigma-1.0*tanh(c-v)*beta^2*v*u-1.0*sigma*beta*alpha*u-1.0*sigma*beta*alpha*w-1.0*beta^2*v*alpha*u-1.0*beta^2*v*alpha*w-sigma^2*beta*alpha*u-sigma^2*beta*alpha*w-sigma*beta^2*v*w-beta^3*v^2*alpha*u-beta^3*v^2*alpha*w-(1.0*I)*Gamma*k*beta*v^2*sech^2*u+(1.0*I)*Gamma*k*beta*v^2*sech^2*w-.50*tanh(c-v)*beta*v*c*sech^2*u+.50*tanh(c-v)*beta*v*c*sech^2*w+I*beta^2*v*u*Gamma*k-I*Gamma*k*beta^2*v*w

(2)

alpha := 0.1;
beta := 0.01;
mu := 0.5;
u := 0.5;
v := 1;
Gamma := 0.1;
c := 2;
w := 0.5;

.1

 

0.1e-1

 

.5

 

.5

 

1

 

.1

 

2

 

.5

(3)

p1i := evalc(Re(Eq));

(-0.11110e-3+0.*I)+0.8980e-2*sigma-0.5600e-3*tanh(1)-0.500e-3*tanh(1)^2+.50900*tanh(1)*sigma+1.0*tanh(1)*sigma^2+.50*tanh(1)^2*sigma+0.1e-1*k^2*sigma+1.0190*sigma^2-0.10e-4*k^2+sigma^3

(4)

p1 := implicitplot(Eq, k = 0 .. 10, sigma = -0.01 .. 0.01);

 

 


Edit.  evalc(Im(Eq))  returns  0. , that is  Eq  is real for real  k  and  sigma  and specific values the other parameters.
 

Download plot_new.mw

We easily get the same result (without the VectorCalculus package) using the standard way to calculate such a curvilinear integral:

restart;
x:=1+t: y:=2*t: # Parametric equations of the line with endpoints (1,0), (2,2)
int( (2*x + y^2)*sqrt(diff(x,t)^2+diff(y,t)^2), t=0..1);

                                        

I think that from a pedagogical point of view, a student studying mathematical analysis should be able to solve such simple examples by hand, and only then, of course, can he check the correctness of the calculations using Maple:

     

 


 

restart;
subexp := M__a*sin(omega*t + alpha)*I__a*sin(omega*t + phi);
subexp2:=factor(combine(subexp));
d:=M__a*I__a:
subexp22:=d*``(subexp2/d)

 

M__a*sin(omega*t+alpha)*I__a*sin(omega*t+phi)

 

(1/2)*M__a*I__a*(cos(alpha-phi)-cos(2*omega*t+alpha+phi))

 

M__a*I__a*``((1/2)*cos(alpha-phi)-(1/2)*cos(2*omega*t+alpha+phi))

(1)

 


 

Download identity.mw

restart;
with(Statistics):
X:=Vector([0,0.001,0.002,0.003,0.004,0.005,0.006,0.007,0.008,0.009,0.01,0.012]):
Y:=Vector([1.103,1.057,1.016,0.978,0.94,0.91,0.88,0.85,0.826,0.8,0.778,0.735]):
Fn:=Fit((-a*t+b)/(-d+e*t+f*t^3),X,Y,t);
add((Y-~[seq(eval(Fn,t=x),x=X)])^~2); # residual sum of squares
plots:-display(plot(X,Y,style=point,color=red,symbolsize=12), plot(Fn,t=X[1]..X[-1],color=blue), labels=["X","Y"]);

Download RS.mw


 

restart;
A:=x<7: B:=-10<x and x<25: C:=x>15:

solve(A and B);

RealRange(Open(-10), 7)

(1)

solve(B or C);

RealRange(Open(-10), infinity)

(2)

solve(A and B and C); # Return NULL that is empty set

solve(A or B or C); # Whole real number axis

x

(3)

 


 

Download solve.mw


 

restart;
S:=proc(n)
local P;
uses combinat;
P:=permute([0$n,1$n]):
select(p->andmap(k->add(p[1..k])<=k/2, [$ 1..2*n]), P);
end proc:

S(3);
nops(%);
seq(nops(S(n)), n=1..7);

 

[[0, 0, 0, 1, 1, 1], [0, 0, 1, 0, 1, 1], [0, 0, 1, 1, 0, 1], [0, 1, 0, 0, 1, 1], [0, 1, 0, 1, 0, 1]]

 

5

 

1, 2, 5, 14, 42, 132, 429

(1)

 


Edit.

Download seq_edit.mw

To avoid repeated calls to Typesetting:-Settings , you can enter your equations through the procedure  below:

restart;
P:=proc(ode)
local t;
t:=indets(ode, name)[];
Typesetting:-Settings(usedot=false,prime=t,typesetprime=true):
ode;
end proc:

ode1:=P(diff(y(t),t$2)+diff(y(t),t)+y(t)= 0);
ode2:=P(diff(y(x),x$2)+diff(y(x),x)+y(x)= 0);

diff(diff(y(t), t), t)+diff(y(t), t)+y(t) = 0

 

diff(diff(y(x), x), x)+diff(y(x), x)+y(x) = 0

(1)

 


 

Download prime.mw

Use  assign  for this instead of  :=  :

restart;
for a from 1 to 2 do
assign(convert(cat("k",a),symbol)=a);
od;
k1, k2;

                                             1, 2

Here is another way of assignment through the seq command (multiple assignment), where  :=  doesn't work, but  assign  does:

restart;
seq(k||i, i=1..2) := seq(a, a=1..2);  # an error
assign(seq(k||i=i, i=1..2));  # OK
k1, k2;  # check

   Error, invalid left hand side in assignment
                              1, 2


 

restart;
assume(omega>0);assume(zeta>0 and zeta<1);
tf:=omega^2/(s^2+2*zeta*omega*s+omega^2);
y:=tf*1/s;
yt:=inttrans:-invlaplace(y,s,t);
dyt:=diff(yt,t);

solve(dyt=0,t, allsolutions);
about(_Z1);

omega^2/(2*omega*s*zeta+omega^2+s^2)

 

omega^2/((2*omega*s*zeta+omega^2+s^2)*s)

 

1-exp(-omega*zeta*t)*cos((-zeta^2+1)^(1/2)*omega*t)-zeta*exp(-omega*zeta*t)*sin((-zeta^2+1)^(1/2)*omega*t)/(-zeta^2+1)^(1/2)

 

exp(-omega*zeta*t)*(-zeta^2+1)^(1/2)*omega*sin((-zeta^2+1)^(1/2)*omega*t)+zeta^2*omega*exp(-omega*zeta*t)*sin((-zeta^2+1)^(1/2)*omega*t)/(-zeta^2+1)^(1/2)

 

Pi*_Z1/((-zeta^2+1)^(1/2)*omega)

 

Originally _Z1, renamed _Z1~:
  is assumed to be: integer

 

 


 

Download dyt.mw

Let's define new functions  Sin, Cos, Tan, Cot  for which arguments are assumed in degrees:

Sin:=x->sin(x*Pi/180):
Cos:=x->cos(x*Pi/180):
Tan:=x->tan(x*Pi/180):
Cot:=x->cot(x*Pi/180):

# Examples
Sin(30);
Tan(45);
Cos(30);

 

1 2 3 4 5 6 7 Last Page 1 of 237