Kitonum

21595 Reputation

26 Badges

17 years, 162 days

MaplePrimes Activity


These are answers submitted by Kitonum


 

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);

 

Probably this integral cannot be calculated symbolically (even for the specific values of the parameters). So calculate numerically.

Example:


 

restart;
t:=1: A:=2: omega:=3: tau:=4: phi:=5:
int( ((-A*omega*sin(omega*x+phi)*exp(-x/tau) - A*cos(omega*x+phi)*exp(-x/tau)/tau)^2 + 1)^(1/2), x=0..t );
int( ((-A*omega*sin(omega*x+phi)*exp(-x/tau) - A*cos(omega*x+phi)*exp(-x/tau)/tau)^2 + 1)^(1/2), x=0..t, numeric );

int(((-6*sin(3*x+5)*exp(-(1/4)*x)-(1/2)*cos(3*x+5)*exp(-(1/4)*x))^2+1)^(1/2), x = 0 .. 1)

 

3.482744646

(1)

 


 

Download int.mw

This can be done in many ways. Here are two options (long and short):


 

restart;
data:=[0,12,0,7,5,3,7,10,0,0,9,3,2,5,0,6]:
N:=0:
for d in data do
if d>=7 then N:=N+1 fi;
od:
N;

5

(1)

nops(select(`>=`, data, 7));

5

(2)

 


 

Download 1.mw


 

restart;
eq1:= (-k*I + 2*I + m)*sqrt(3) - 3*I*m - 3*k;
eq2:=eq1/2;
eq_given:= a*(k + I*m) + b;

match(eq2 = eq_given, {k,m}, 's');
s;

(-I*k+2*I+m)*3^(1/2)-(3*I)*m-3*k

 

(1/2)*(-I*k+2*I+m)*3^(1/2)-((3/2)*I)*m-(3/2)*k

 

a*(k+I*m)+b

 

true

 

{a = -((1/2)*I)*(3^(1/2)-3*I), a = -((1/2)*I)*3^(1/2)-3/2, b = I*3^(1/2)}

(1)

 


 

Download Q20200817_new.mw


 

restart;
Expr:=W__1 + W__2 = -sin(-beta + alpha)*((H^2 - h^2)*gamma + h^2*psi)/(2*sin(beta)*sin(alpha));
applyop(p->H^2*p,2,applyop(p->collect(expand(p/H^2),gamma),[2,3],Expr));

W__1+W__2 = -(1/2)*sin(-beta+alpha)*((H^2-h^2)*gamma+h^2*psi)/(sin(beta)*sin(alpha))

 

W__1+W__2 = -(1/2)*H^2*sin(-beta+alpha)*((1-h^2/H^2)*gamma+h^2*psi/H^2)/(sin(beta)*sin(alpha))

(1)

 


 

Download 1.mw

Example:

restart;
N:=8: # The number of the points
plot([seq([n/(N-1),ln(1+sin(Pi*n/(N-1)))], n=0..N-1)], legend = numerical, style = point, symbol = box, color = blue, symbolsize = 15);

 

1. Don't use square brackets to group terms, only parentheses.
2. In this example, use  simplify  with  siderels :


 

restart;

with(Student[LinearAlgebra]):

eq4:= v__a(t) = (v__an(t)-v__ap(t))/2 - L__arm/2*diff((i__ap(t)-i__an(t)), t) - R__arm/2*(i__ap(t)-i__an(t));

v__a(t) = (1/2)*v__an(t)-(1/2)*v__ap(t)-(1/2)*L__arm*(diff(i__ap(t), t)-(diff(i__an(t), t)))-(1/2)*R__arm*(i__ap(t)-i__an(t))

(1)

eq4_2:= simplify(eq4, {i__ap(t)-i__an(t) = i__a(t)});

v__a(t) = (1/2)*v__an(t)-(1/2)*v__ap(t)-(1/2)*L__arm*(diff(i__a(t), t))-(1/2)*R__arm*i__a(t)

(2)

 


 

Download Maximum_Modulation_Index_for_MMC_with_CCC_new.mw
 

In fact, your simplification requires no assumptions. You can get an even better simplification through  tan(x/2) :


 

restart;
u1:=-ln(csc(x)-cot(x));
simplify(u1);
convert(u1, tan);
eval(%, {tan(x)=2*tan(x/2)/(1-tan(x/2)^2)});
applyop(normal,[2,1],%);

-ln(csc(x)-cot(x))

 

-ln((1-cos(x))/sin(x))

 

-ln((1/2)*(1+tan((1/2)*x)^2)/tan((1/2)*x)-1/tan(x))

 

-ln((1/2)*(1+tan((1/2)*x)^2)/tan((1/2)*x)-(1/2)*(1-tan((1/2)*x)^2)/tan((1/2)*x))

 

-ln(tan((1/2)*x))

(1)

 


 

Download simpl.mw

Your system only has a zero solution:


 

restart; with(LinearAlgebra)

M := Matrix(Matrix(7, 7, {(1, 1) = -mu, (1, 2) = a[1]*beta[x]*k[1]*PI[h]/mu, (1, 3) = omega[o]*beta[x]*a[1]*PI[h]/mu, (1, 4) = sigma, (1, 5) = -beta[2]*PI[h]/mu, (1, 6) = 0, (1, 7) = a[1]*beta[x]*k[2]*PI[h]/mu, (2, 1) = 0, (2, 2) = -(mu+r[o]+alpha[o])*a[1]*beta[x]*k[1]*PI[h]/mu, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = a[1]*beta[x]*k[2]*PI[h]/mu, (3, 1) = 0, (3, 2) = 0, (3, 3) = -(mu+r[1]+alpha[1]+k[o])*a[1]*beta[x]*k[1]*PI[h]/mu, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (3, 7) = omega[o]*beta[x]*a[1]*k[2]*PI[h]/mu, (4, 1) = 0, (4, 2) = r[o], (4, 3) = r[1], (4, 4) = -mu-sigma, (4, 5) = 0, (4, 6) = 0, (4, 7) = 0, (5, 1) = 0, (5, 2) = alpha[o], (5, 3) = alpha[1], (5, 4) = 0, (5, 5) = -e[o], (5, 6) = 0, (5, 7) = 0, (6, 1) = 0, (6, 2) = -a[2]*beta[y]*k[1]*PI[m]/mu[b], (6, 3) = -a[2]*beta[y]*k[2]*PI[m]/mu[b], (6, 4) = 0, (6, 5) = -a[2]*beta[y]*PI[m]/mu[b], (6, 6) = -mu[b], (6, 7) = 0, (7, 1) = 0, (7, 2) = a[2]*beta[y]*k[2]*PI[m]/mu[b], (7, 3) = a[2]*beta[y]*k[2]*PI[m]/mu[b], (7, 4) = m[7, 4], (7, 5) = a[2]*beta[y]*PI[m]/mu[b], (7, 6) = 0, (7, 7) = -mu[b]})); V := Vector([`$`(0, 7)])

Matrix(7, 7, {(1, 1) = -mu, (1, 2) = a[1]*beta[x]*k[1]*PI[h]/mu, (1, 3) = omega[o]*beta[x]*a[1]*PI[h]/mu, (1, 4) = sigma, (1, 5) = -beta[2]*PI[h]/mu, (1, 6) = 0, (1, 7) = a[1]*beta[x]*k[2]*PI[h]/mu, (2, 1) = 0, (2, 2) = -(mu+r[o]+alpha[o])*a[1]*beta[x]*k[1]*PI[h]/mu, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (2, 7) = a[1]*beta[x]*k[2]*PI[h]/mu, (3, 1) = 0, (3, 2) = 0, (3, 3) = -(mu+r[1]+alpha[1]+k[o])*a[1]*beta[x]*k[1]*PI[h]/mu, (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (3, 7) = omega[o]*beta[x]*a[1]*k[2]*PI[h]/mu, (4, 1) = 0, (4, 2) = r[o], (4, 3) = r[1], (4, 4) = -mu-sigma, (4, 5) = 0, (4, 6) = 0, (4, 7) = 0, (5, 1) = 0, (5, 2) = alpha[o], (5, 3) = alpha[1], (5, 4) = 0, (5, 5) = -e[o], (5, 6) = 0, (5, 7) = 0, (6, 1) = 0, (6, 2) = -a[2]*beta[y]*k[1]*PI[m]/mu[b], (6, 3) = -a[2]*beta[y]*k[2]*PI[m]/mu[b], (6, 4) = 0, (6, 5) = -a[2]*beta[y]*PI[m]/mu[b], (6, 6) = -mu[b], (6, 7) = 0, (7, 1) = 0, (7, 2) = a[2]*beta[y]*k[2]*PI[m]/mu[b], (7, 3) = a[2]*beta[y]*k[2]*PI[m]/mu[b], (7, 4) = m[7, 4], (7, 5) = a[2]*beta[y]*PI[m]/mu[b], (7, 6) = 0, (7, 7) = -mu[b]})

 

Vector[column](%id = 18446745476990704686)

(1)

LinearSolve(M, V)

Vector[column](%id = 18446745477001216958)

(2)

 


 

Download trc_new.mw

 

Here is the procedure to write explicitly this double sum:

restart;
S:=n->sum(sum(a[i,j]*x^i*y^j, j=0..n-i), i=0..n);

# Example
S(3);

proc (n) options operator, arrow; sum(sum(a[i, j]*x^i*y^j, j = 0 .. n-i), i = 0 .. n) end proc

 

x^3*a[3, 0]+x^2*y*a[2, 1]+x*y^2*a[1, 2]+y^3*a[0, 3]+x^2*a[2, 0]+x*y*a[1, 1]+y^2*a[0, 2]+x*a[1, 0]+y*a[0, 1]+a[0, 0]

(1)

 


 

Download double_sum.mw

First 53 54 55 56 57 58 59 Last Page 55 of 290