Kitonum

21435 Reputation

26 Badges

17 years, 26 days

MaplePrimes Activity


These are answers submitted by Kitonum

I removed the square brackets that you use to group expressions. To do this, Maple should use only parentheses. Brackets are used to create lists. Some corrections were also made to improve the quality of the graphs:


 

restart;
A[0] := 0;                           
A[1] := sqrt(2*(k[1]^2-w[1]^2))/sqrt(lambda);                             
A[2] := sqrt(2*(k[2]^2-w[2]^2))/sqrt(lambda);                             
c[1] := 1;
c[2] := 1;
c[3] := 1;
c[4] := 1;
c[5] := 1;
c[6] := 1;
k[1] := 10.5;
k[2] := 3.5;
w[1] := 5.05;
w[2] := .5;
m := 1.9;
lambda := 1.75;
xi[1] := -t*w[1]+x*k[1];
xi[2] := -t*w[2]+x*k[2];
a := m/sqrt(k[1]^2-w[1]^2);
b := m/sqrt(k[2]^2-w[2]^2);
g := a*(c[2]*cos(a*xi[1])-c[3]*sin(a*xi[1]));
h := c[1]+c[2]*sin(a*xi[1])+c[3]*cos(a*xi[1]);
G := b*(c[5]*cos(b*xi[2])-c[6]*sin(b*xi[2]));
H := c[4]+c[5]*sin(b*xi[2])+c[6]*cos(b*xi[2]);
u := A[0]+A[1]*g/h+A[2]*G/H;
  

0

 

(2*k[1]^2-2*w[1]^2)^(1/2)/lambda^(1/2)

 

(2*k[2]^2-2*w[2]^2)^(1/2)/lambda^(1/2)

 

1

 

1

 

1

 

1

 

1

 

1

 

10.5

 

3.5

 

5.05

 

.5

 

1.9

 

1.75

 

-5.05*t+10.5*x

 

-.5*t+3.5*x

 

.2063907138

 

.5484827558

 

.2063907138*cos(1.042273105*t-2.167102495*x)+.2063907138*sin(1.042273105*t-2.167102495*x)

 

1-sin(1.042273105*t-2.167102495*x)+cos(1.042273105*t-2.167102495*x)

 

.5484827558*cos(.2742413779*t-1.919689645*x)+.5484827558*sin(.2742413779*t-1.919689645*x)

 

1-sin(.2742413779*t-1.919689645*x)+cos(.2742413779*t-1.919689645*x)

 

9.841457496*(.2063907138*cos(1.042273105*t-2.167102495*x)+.2063907138*sin(1.042273105*t-2.167102495*x))/(1-sin(1.042273105*t-2.167102495*x)+cos(1.042273105*t-2.167102495*x))+3.703280398*(.5484827558*cos(.2742413779*t-1.919689645*x)+.5484827558*sin(.2742413779*t-1.919689645*x))/(1-sin(.2742413779*t-1.919689645*x)+cos(.2742413779*t-1.919689645*x))

(1)

plot3d(u, x = -10 ..0.2, t = -10 .. 0.2, view=-50..50, grid=[200,200]);
 

 

plot(eval(u,t=0), x = -15 .. 15, -50..50, numpoints=5000, discont, size=[800,400]);

 

 


 

Download 2plots.mw

is(expand(B*exp(I*Pi/3))=expand(A));
                                                                   
 true

# Or

factor(expand(A/B));
polar(%);


Edit.
 

sum(2^k, k=0..n);
                                               
2^(n+1)-1

# Check for n=5
sum(`2`^k, k=0..5)=sum(2^k, k=0..5);
                             
2^5+2^4+2^3+2^2+2+1 = 63

We see that  63=2^6-1

This result  2^(n+1)-1  is the same as your answer, because  2*2^n-1 2^(n+1)-1

The imaginary unit in Maple should be coded as  I  (not as i). i is just a symbol in Maple.

Re((1+I)^2); 
Im((1+I)^2);

                                           0
                                           2

You can use  plots:-inequal  command:

restart;
A:=plot(sin(x), x=-3*Pi/4-0.3..9*Pi/4+0.3, color=red, thickness=3):
B:=plot(cos(x), x=-3*Pi/4-0.3..9*Pi/4+0.3, color=blue, thickness=3):
C:=plots:-inequal((y-cos(x))*(y-sin(x))<0, x=-3*Pi/4..9*Pi/4, y=-1.2..1.2, color=yellow):
plots:-display(A,B,C, scaling=constrained, size=[1000,300]);
         


Addition. The  plots:-inequal  command especially useful when a plane region is given by inequalities of the form  F(x,y)<0  or  F(x,y)>0 . Here is an example of painting over the regions obtained by different intersections of three circles:

with(plots):
C1:= (x+sqrt(7))^2+y^2-16: 
C2 := x^2+(y-3)^2-9: 
C3 := (x-4)^2+y^2-25:
Range:=x=-7..9.5, y=-5.5..6.5:
P:=implicitplot([C1,C2,C3], Range, color=black, thickness=2):
R1:=inequal({C1<0,C2<0,C3<0},  Range, color=blue, nolines):
R2:=inequal({{C1<0,C2<0},{C1<0,C3<0},{C2<0,C3<0}},  Range, color=yellow, nolines):
R3:=inequal({{C1<0,C2>0,C3>0},{C1>0,C2<0,C3>0},{C1>0,C2>0,C3<0}}, Range, color=green, nolines):
display(P,R1,R2,R3, scaling=constrained, size=[600,500]);
                 


 

restart

"P(t):=(r*Q[inf])/(2+2 cosh(b-r*t));"

proc (t) options operator, arrow, function_assign; r*Q[inf]/(2+2*cosh(b-r*t)) end proc

(1)

"Q(t):=(&int;)[0]^(t)P(t) &DifferentialD;t assuming real;"

proc (t) options operator, arrow, function_assign; `assuming`([int(P(t), t = 0 .. t)], [real]) end proc

(2)

value(Q(t))

(1/2)*Q[inf]*tanh((1/2)*b)-(1/2)*Q[inf]*tanh(-(1/2)*t*r+(1/2)*b)

(3)

 


 

Download Hubbert-new.mw

Maybe the following is what you want:


 

restart;
v := 145000;
thetavn := (1/6)*Pi;
omegac := .1;
x:=omegac*t;
s := cos(2*thetabn)*x+2*sin(thetabn)^2*sin(x);
plots:-implicitplot(s = 0, t = -200 .. 200, thetabn = 43*Pi*(1/180) .. 88*Pi*(1/180), tickmarks = ["decimalticks","piticks"], gridrefine = 4, size = [800, 600]);

145000

 

(1/6)*Pi

 

.1

 

.1*t

 

.1*cos(2*thetabn)*t+2*sin(thetabn)^2*sin(.1*t)

 

 

 


 

Download plot.mw

Edit.

I fixed only 1 line:

GAUSSIAN_new.mw

When calculating the derivative of a function at a point, it is better to use the differentiation operator  D  than  eval  command (simpler and more compact syntax). For example:

eval(diff(x^2,x), x=2.5);
D(x->x^2)(2.5);
                                                 
5.0
                                                 5.0


In your example, you are trying to differentiate the function at points where it is not defined. See:

restart;
y := x-> (1-Heaviside(x-0.10e-1))*(cos(9.0218219*x)-.99533285*sin(9.0218219*x)-.99999991*cosh(9.0218219*x)+.99533285*sinh(9.0218219*x))+(Heaviside(x-0.10e-1)-Heaviside(x-0.418e-1))*(.24369100*cos(7.7520047*x)-.36109859*sin(7.7520047*x)-.23739778*cosh(7.7520047*x)+.19615343*sinh(7.7520047*x))+Heaviside(x-0.418e-1)*(.95680995*cos(9.0218219*x)-.80884870*sin(9.0218219*x)-1.0381918*cosh(9.0218219*x)+1.1704059*sinh(9.0218219*x)):
convert(y(x), piecewise);
y(0.418e-1);
y(0.1e-1);

   

 

This bug occurs when using the palette in 2d math input. Instead, enter a vector or a matrix using angle brackets directly from the keyboard. It's much faster:

 

 

We can immediately (without even using  combinat  package) obtain all such sums for any (the list  L ) if we first construct the corresponding generating function (the polynom  P ).

Example:

n:=5:
P:=collect(expand(mul(x+~[a||(0..n-1)])), x);
L:=[seq(coeff(P,x,n-k), k=1..n)];

   

 

I guess that you are looking for real roots  (x1, y1) , and  t, b, n  are parameters. Your system has the form  {eq1, eq2} = {f(x1)=f(y1), g(x1)=g(y1)}  in which  f = x->t/(x-1)/x^2-b*n/6/x^2*x^(-n-1), g = x->t*(0.74/(x-1)/x^3-3*ln(x-1))+b/x^(n)*(1/2-0.74*n/6/x^4) . Obviously, this system always has an infinite number of solutions  (x1,y1) = (x,x) , in which x>1 . If  f  or  g  is monotonous, then there are no other solutions.

The  extrema  command allows in many cases to symbolically find local extremes of smooth multidimensional problems with smooth constraints. For the solution, the Lagrange multipliers method is used. We get a more accurate solution with less cost. Unfortunately, the exact symbolic result is quite cumbersome and its approximation is shown below:

Digits:=25:
min(extrema((x[1]-1)^2+(x[2]-1)^2+(x[3]-1)^2, x[1]*(x[2]^2+x[3]^2+1)=8, {x[1], x[2], x[3]}, 's')):
evalf(%);
evalf(s):
select(p->`and`(seq(eval(x[i], p)>=1 and eval(x[i], p)<=2, i=1..3)), %)[];
evalf[23](eval((x[1]-1)^2+(x[2]-1)^2+(x[3]-1)^2, %)); # Check

The output:
                                      0.69329028371527531623476
         {x[1] = 1.531665799394114675166437, x[2] = 1.453112437188548339089389, x[3] = 1.453112437188548339089389}
                                      0 .69329028371527531623477


From a geometrical point of view, we found the value of the objective function  (x[1]-1)^2+(x[2]-1)^2+(x[3]-1)^2  when its level surfaces  (x[1]-1)^2+(x[2]-1)^2+(x[3]-1)^2=С  (in your example these are ordinary spheres) touch the surface  x[1]*(x[2]^2+x[3]^2+1)=8  for the first time.

Addition. Since Optimization:-Minimize and extrema commands generally return local extremes (and extrema command - the critical points), it is useful to verify the result obtained using  DirectSearch:-GlobalOptima  command, which searches for the global extremum using a direct search without derivatives:

restart;
DirectSearch:-GlobalOptima((x[1]-1)^2+(x[2]-1)^2+(x[3]-1)^2, {x[1]*(x[2]^2+x[3]^2+1)>=8, seq(op([x[i]>=1,x[i]<=2]), i=1..3)});
     
[0.693290285423826, [x[1] = 1.53164167847983, x[2] = 1.45310861919799, x[3] = 1.45314455787912], 411]       

 


 

restart

a := Vector[row](1 .. 10)

Vector[row](%id = 18446745435669242694)

(1)

randomize()

for k to 10 do r := rand(1 .. 2); if r() < 1.5 then a[k] := "H" else a[k] := "T" end if end do

a

Vector[row](%id = 18446745435669242694)

(2)


 

Download CoinToss_new.mw

I don’t know how to extract the vector structures you are writing about, but just to simplify the trigonometric expression  applyrule command can help. First we apply  simplify command to your expression, and then applyrule command, and in the list we indicate the formulas that applyrule may need. The following is a simplified example of yours, in which I just replaced the names of the angles using simple indexing:

Expr:=cos(theta__a)*cos(theta__b)+sin(theta__a)*cos(phi__a)*sin(theta__b)*cos(phi__b)+sin(theta__a)*sin(phi__a)*sin(theta__b)*sin(phi__b):
# Simplification of Expr
applyrule([cos(t::anything)*cos(s::anything)+sin(t::anything)*sin(s::anything)=cos(t-s), cos(t::anything)*cos(s::anything)-sin(t::anything)*sin(s::anything)=cos(t+s), sin(t::anything)*cos(s::anything)+cos(t::anything)*sin(s::anything)=sin(t+s), sin(t::anything)*cos(s::anything)-cos(t::anything)*sin(s::anything)=sin(t-s)],simplify(Expr));

Output:       


In the code for  applyrule  I wrote down 4 well-known addition formulas for sine and cosine, but you can add formulas of multiple angles, etc.
The commands  applyop , subsindets  can also be useful for selective use.

First 95 96 97 98 99 100 101 Last Page 97 of 289