Kitonum

21445 Reputation

26 Badges

17 years, 41 days

MaplePrimes Activity


These are answers submitted by Kitonum

The construction by  plot  command:

evalc(subs(z=x+I*y, abs(z*exp(1-z))))=1;

Eq:=solve(%, y);  # Explicit equations for the two branches of the function  y(x)

plot([Eq], x=-1..2,color=red, thickness=2, scaling=constrained);

                              

 

 

 Addition: The equations  Eq  allow  it easy to find, if necessary, loop size, its area, etc.

Edited.

The equations are algebraically dependent, and the second equation is a consequence of the first equation. See

restart;

a:=sin(165*Pi/180-theta)/10=sin(theta)/y;

b:=(y^2-20*y*cos(Pi/12)+100)*sin(165*Pi/180-theta)^2/100=sin(Pi/12)^2;

E:=eliminate({a,b},y);

simplify(E[2,1]);

 

 

That is, if from the first equation we express  y  and substitute into the second equation, we obtain 0. Therefore, it is enough to solve the first equation only, which has a unique solution for each  theta

 View  option helps you:

               

 

 

with(geometry):

point(A,0,0), point(B,4,0), point(C,5,3):

triangle(T, [A, B, C]):

incircle(ic,T, 'centername'=`O`):

L:=plots[textplot]([[0.05,0,A],[4.05,0,B],[5.05,3,C],[coordinates(`O`)[1]+0.05,coordinates(`O`)[2],`O`]], font=[TIMES,ROMAN,20], align=[right,below]):

plots[display](draw([A(symbol = solidcircle),B(symbol = solidcircle),C(symbol = solidcircle), T(color=blue,thickness=2),ic(color=green,thickness=2),`O`(symbol = solidcircle)]),L, view=[-0.5..5.5,-0.5..3.5]);

              

 

 Edited.

 

 


Sys := [m1*(diff(x1(x), x, x))+cv1*(diff(x1(x), x))+(k1+k2+k4)*x1(x)-k2*x2(x)-k4*x3(x) = f1(t), m2*(diff(x2(x), x, x))+cv2*(diff(x2(x), x))-cv2*(diff(x3(x), x))+(k2+k3)*x2(x)-k2*x1(x)-k3*x3(x) = f2(t), m3*(diff(x3(x), x, x))+cv2*(diff(x3(x), x))-cv2*(diff(x2(x), x))+(k3+k4)*x3(x)-k3*x2(x)-k4*x1(x) = f1(t)];

[m1*(diff(diff(x1(x), x), x))+cv1*(diff(x1(x), x))+(k1+k2+k4)*x1(x)-k2*x2(x)-k4*x3(x) = f1(t), m2*(diff(diff(x2(x), x), x))+cv2*(diff(x2(x), x))-cv2*(diff(x3(x), x))+(k2+k3)*x2(x)-k2*x1(x)-k3*x3(x) = f2(t), m3*(diff(diff(x3(x), x), x))+cv2*(diff(x3(x), x))-cv2*(diff(x2(x), x))+(k3+k4)*x3(x)-k3*x2(x)-k4*x1(x) = f1(t)]

(1)

X := [x1(x), x2(x), x3(x)]; DX := diff(X, x); D2X := diff(X, x, x); SM := LinearAlgebra[GenerateMatrix](Sys, X); M1 := SM[1]; SM1 := LinearAlgebra[GenerateMatrix](convert(-SM[2], list), DX); M2 := SM1[1]; SM2 := LinearAlgebra[GenerateMatrix](convert(-SM1[2], list), D2X); M3 := SM2[1]; R := SM2[2]; Result := M3.``(convert(D2X, Vector))+M2.``(convert(DX, Vector))+M1.``(convert(X, Vector)) = R

Typesetting[delayDotProduct](Matrix(3, 3, {(1, 1) = m1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = m2, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = m3}), `.`(Vector(3, {(1) = diff(diff(x1(x), x), x), (2) = diff(diff(x2(x), x), x), (3) = diff(diff(x3(x), x), x)})), true)+Typesetting[delayDotProduct](Matrix(3, 3, {(1, 1) = cv1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = cv2, (2, 3) = -cv2, (3, 1) = 0, (3, 2) = -cv2, (3, 3) = cv2}), `.`(Vector(3, {(1) = diff(x1(x), x), (2) = diff(x2(x), x), (3) = diff(x3(x), x)})), true)+Typesetting[delayDotProduct](Matrix(3, 3, {(1, 1) = k1+k2+k4, (1, 2) = -k2, (1, 3) = -k4, (2, 1) = -k2, (2, 2) = k2+k3, (2, 3) = -k3, (3, 1) = -k4, (3, 2) = -k3, (3, 3) = k3+k4}), `.`(Vector(3, {(1) = x1(x), (2) = x2(x), (3) = x3(x)})), true) = (Vector(3, {(1) = f1(t), (2) = f2(t), (3) = f1(t)}))

(2)

NULL


Download SystemMatrixForm.mw

 

Addition: It's a pretty cumbersome solution can easily be rewritten in the form of a procedure, suitable for all the similar systems.

Edited.

The plot of the function  psi(x,eta) = x*f(eta)+int(h(s), s = 0 .. eta):


restart;

eq1:=diff(f(eta),eta,eta,eta)+f(eta)*diff(f(eta),eta,eta)-(diff(f(eta),eta))^2+1:

eq2 := diff(h(eta),eta,eta)+f(eta)*diff(h(eta),eta)-diff(f(eta),eta)*h(eta):

bc:=f(0)=0,D(f)(0)=0,D(f)(6)=1,h(0)=0,D(h)(6)=1:

A1:=dsolve({eq1,eq2,bc}, numeric, method=bvp[midrich], abserr = 1.*10^(-10), output=operator);

plot3d(eval(x*f(eta)+int(h(s), s = 0 .. eta), A1), x=0..1, eta=0..1, axes=normal); 

 

Tilde means element-wise operator.  Let  P  is any command.

P~([A, B, C]);  

is equivalent to

[P(A), P(B), P(C)]; 

 

Tilde as the element-wise operator appeared in Maple 13 or Maple 14. Instead tilde, you can use the older command  map :

map(P, [A, B, C]);

 

For details see help  ?element-wise operators   and   ?map

 

 

Your example:

a := 4;

b := 5;

cat(`a+b`,` = `, convert(a,symbol)+convert(b,symbol), ` = `, a+b);

                                        

 

 

 

I used the excellent  vv's idea of reducing the problem to the study of a function of one variable  t . Substitution  x=t/n  works for all  n<>0 . The case  n=0  is trivial and can be easily dealt with separately. Because  yy  is periodic with the period  2*Pi, it is enough to look for the maximum in the range  0..2*Pi .

Here is a symbolic solution:

y := 0.11083e-1+0.66489e-1*cos(n*x)+0.22089e-1*cos(2*n*x)+0.8903e-2*cos(3*n*x)-0.293e-3*cos(4*n*x):

yy := convert(subs(x = t/n, y), fraction);

maximize(yy, t = 0 .. 2*Pi, location);  # location option gives values  t  for maximum points

plot(yy, t = 0 .. 2*Pi);  # Visual verification

                     

 

 

 

 

Custom procedure  P  makes it faster:

restart;

P:=proc(M1::posint,M2::posint)

local A, B, k, r, c;

A:=M1; B:=M2;

k:=0:

while B>0 do

r:=irem(A,B,'q'):  A:=B:  B:=r:

k:=k+1: c[k]:=q:

od:

convert(c, list);

end proc:

 

M1:=146996733613391:

M2:=1348471408813:

teks:= CodeTools:-Usage(P(M1,M2));

    

I did not realize what time you want to reduce. If you need a custom code that solves the same problem, here it is

restart;

M1:=146996733613391:

M2:=1348471408813:

k:=0:

while M2>0 do

r:=irem(M1,M2,'q'):  M1:=M2:  M2:=r:

k:=k+1: c[k]:=q:

od:

convert(c, list);

                                 [109, 101, 115, 115, 97, 103, 101]

t:= `Hello Bob  `;

cat(t$5);

Slightly more efficient will be the enumeration in a nested seq . Also I use LinearAlgebra[Determinant] mod 2 :

restart;

NestedSeq:=proc(Expr::algebraic, L::list)

local S;

eval(subs(S=seq, foldl(S, Expr, op(L))));

end proc:

M:=[i||(1..16)]:

GROUP:=[NestedSeq('`if`(LinearAlgebra[Determinant](Matrix(4, M)) mod 2<>0, cat(op(M)), NULL)',M=~0..1)]:

nops(GROUP);

                                                      20160

 

Perhaps you have confused  YP__1  with  YP[1] . These are different things. The first is a simple symbol, which look like an indexed symbol, the second is a true indexed symbol.  Compare what they look like in output:

restart;

whattype ~ ([YP__1, YP[1]]);

YP__1, YP[1];

                                

 

If they are not confused with one another, then everything is OK:

Eq:= YP[1]=Y[2]:

subs(YP[1]=dGx, Eq);

or

Eq:= YP__1 = Y__2:

subs(YP__1=dGx, Eq);

 

 

 

 

If some elements are repeated in a list,  ListTools:-SearchAll  command finds all the positions:

L := [x,z,y,x,x,z]:

ListTools:-SearchAll(x, L);

                                            1, 4, 5

 

Similar commands there are in  StringTools  package.

First 187 188 189 190 191 192 193 Last Page 189 of 289