Kitonum

19004 Reputation

26 Badges

14 years, 84 days

MaplePrimes Activity


These are answers submitted by Kitonum

a-bar is an invalid name in Maple. See a fragment from help on ?names:

"A name in its simplest form is a letter followed by zero or more letters, digits, underscore characters (_) and question marks (?), with lowercase and uppercase letters distinct.  The maximum length of a name is system dependent. On 32-bit platforms, it is 268,435,439 characters; on 64-bit platforms, it is 34,359,738,335 characters.
There are two types of names: indexed names and symbols (non-indexed names)."

It's unclear why your copy of Maple isn't signaling an error.

In Maple 2018:

Using the triple integral, we find the first coordinate  x0  of the center of mass of this body (the second and third coordinates are equal to 0 due to symmetry), as well as the moment of inertia  J  for the axis of revolution through the center of mass and parallel to the y axis:

restart;
Eq:=x^2/3^2+y^2/2^2+z^2/1^2=1;
Sol_z:={solve(Eq, z)};
Sol_y:={solve(eval(Eq,z=0), y)};
x0:=int(x, [z=Sol_z[1]..Sol_z[2],y=Sol_y[1]..Sol_y[2], x=-2..1])/int(1, [z=Sol_z[1]..Sol_z[2],y=Sol_y[1]..Sol_y[2], x=-2..1]);
J:=int((x-x0)^2+z^2, [z=Sol_z[1]..Sol_z[2],y=Sol_y[1]..Sol_y[2], x=-2..1]);

                         

                  

In such examples, it is advisable to use functional notation, because we get a simpler and shorter code:

restart;
x:=t->2*a+b*t+2*t;
solve({x(0)=1, x(1)=1});

                                                    

 

with(Units:-Standard):
seq(ii*Unit('m'), ii = 1.0.. 10.0);

 

You can calculate the sum of this alternating number series with the  sum  command:

sum((-1)^(n-1)/(2*n-1), n=1..infinity);

                                                     

 

NULL

restart

with(LinearAlgebra)

F[1] := 1/2+(3/4)*x[0]*y[0]+x[0]+(3/8)*y[0]

1/2+(3/4)*x[0]*y[0]+x[0]+(3/8)*y[0]

(1)

F[2] := -1/2-(1/8)*x[0]^2+(5/8)*y[0]^2-(1/8)*x[0]+y[0]

-1/2-(1/8)*x[0]^2+(5/8)*y[0]^2-(1/8)*x[0]+y[0]

(2)

F[3] := 1/2+(3/4)*u[0]*z[0]+(3/8)*u[0]+x[0]

1/2+(3/4)*u[0]*z[0]+(3/8)*u[0]+x[0]

(3)

F[4] := -1/2+(5/8)*u[0]^2-(1/8)*z[0]^2+y[0]-(1/8)*z[0]

-1/2+(5/8)*u[0]^2-(1/8)*z[0]^2+y[0]-(1/8)*z[0]

(4)

Sol := {solve({F[1] = 0, F[2] = 0, F[3] = 0, F[4] = 0}, {u[0], x[0], y[0], z[0]}, explicit)}; nops(Sol); select(proc (t) options operator, arrow; `and`(`~`[type](eval([x[0], y[0], z[0], u[0]], t), realcons)[]) end proc, Sol)

16

 

{{u[0] = -4/5-(1/10)*139^(1/2), x[0] = -1/2, y[0] = -4/5-(1/10)*139^(1/2), z[0] = -1/2}, {u[0] = -4/5+(1/10)*139^(1/2), x[0] = -1/2, y[0] = -4/5+(1/10)*139^(1/2), z[0] = -1/2}, {u[0] = 4/5-(1/10)*139^(1/2), x[0] = -1/2, y[0] = -4/5+(1/10)*139^(1/2), z[0] = -1/2}, {u[0] = 4/5+(1/10)*139^(1/2), x[0] = -1/2, y[0] = -4/5-(1/10)*139^(1/2), z[0] = -1/2}}

(5)

nops(%)

4

(6)

 

Download roots_(1)_new.mw

To check whether a number is even or odd, you do not need any formula, just use the  type  command. If you want to check the terms in the sum, then the sum itself must be written in inert form, otherwise Maple will automatically calculate it and the terms themselves will be lost.

Examples:

restart;
a:=2%+3;
type(op(1,a),odd);
type(op(1,a),even);
type(op(2,a),odd);

                                                

restart;
k:=[seq(1.1..1.3, 0.1)];
plot([seq(x+i, i=k)], x=0..1);

 

By using the  limit  command (according to the definition of an improper integral), you can easily work around this bug:

restart;
int( exp(-2*r)*cos(theta)^3*r^2*sin(theta), phi=0..2*Pi, theta=0..Pi, r=0..R);
limit(%, R=infinity);

                                                     0
                                                     0

See help on the  LinearAlgebra:-MatrixFunction  command.

Example:

restart;
A:=Matrix([[1,2],[3,4]]);
LinearAlgebra:-MatrixFunction(A, sin(x), x);

 

@brian bovril  I completely redid my answer.
The code below returns all possible options where no player is in two matches in a row. The result is the same as Carl's, but the code does not use the Iterator package, so it is suitable for older versions of Maple:

restart:
TA := [A, B, C]:
TB := [X, Y, Z]:
n:=nops(TA):
L:=convert(Matrix(n, (i,j)->[TA[i],TB[j]])^%T, list):
P:=combinat:-permute(L):
k:=0:
for p in P do
if `and`(seq(nops({p[i][],p[i+1][]})=4, i=1..nops(L)-1)) then k:=k+1; 
print(p) fi;
od:
k;  

 

I don't have Maple 2021, but I'm using Maple 2018. In this version, for some reason, your code doesn't work. But the modified version works:

restart;
with(GraphTheory):
g:=[seq(CompleteGraph(i),i=2..6)]:
plots:-display(DrawGraph~(convert(g,Vector[row]), style=spring, stylesheet = [vertexcolor = "Pink"]), size=[200,200]);

 


 

restart

F := [.2169, .1929, .1688, .1448, .1207, 0.9672e-1, 0.7266e-1, 0.4861e-1, 0.245e-1]

[.2169, .1929, .1688, .1448, .1207, 0.9672e-1, 0.7266e-1, 0.4861e-1, 0.245e-1]

(1)

plot([seq(0 .. 1, 1/(nops(F)-1))], F, style = pointline, color = red, symbol = solidcircle, symbolsize = 12)

 

NULL


 

Download help_graph_new.mw

Probably your system can only be solved numerically:

restart;
odeSystem := {diff(y1(x), x) = -x*y2(x)-(1+x)*y3(x), diff(y2(x), x) = -x*y1(x)-(1+x)*y4(x), diff(y3(x), x) = -x*y1(x)-(1+x)*y4(x)-5*x*cos((1/2)*x^2), diff(y4(x), x) = -x*y2(x)-(1+x)*y3(x)+5*x*sin((1/2)*x^2), y1(0) = 5, y2(0) = 1, y3(0) = -1, y4(0) = 0}:
systemSol := dsolve(odeSystem, numeric):
plots:-odeplot(systemSol,[[x,y1(x)],[x,y2(x)],[x,y3(x)],[x,y4(x)]], x=0..1, color=[red,blue,green,gold], legend=[y1(x),y2(x),y3(x),y4(x)]); 

                                             

Here is another way to solve the problem using the custom procedure named  Circumcircle .  We can get both general formulas for the center and radius of the circumscribed circle of an arbitrary triangle, and specific results for a given triangle. We find the center of the circumscribed circle as the point of intersection of the two perpendicular bisectors to the sides of the triangle:

restart;
Circumcircle:=proc(A::Vector,B::Vector,C::Vector)
local P1, P2, AB, AC, Line1, Line2, P0, R;
P1:=(A+B)/2; P2:=(A+C)/2; AB:=B-A; AC:=C-A;
Line1:=AB[1]*(x-P1[1])+AB[2]*(y-P1[2]);
Line2:=AC[1]*(x-P2[1])+AC[2]*(y-P2[2]);
solve({Line1,Line2}, {x,y});
P0:=eval(<x,y>, %);
R:=sqrt((P0-A).(P0-A)) assuming real;
convert(P0,list), simplify(R);
end proc:

Examples of use

Circumcircle(<x1,y1>,<x2,y2>,<x3,y3>);
A:=<0,0>: B:=<7,0>: C:=<2,4>:
P0,R := Circumcircle(A,B,C);
plots:-display(plottools:-curve(convert~([A,B,C,A],list), color=blue, thickness=2),plottools:-circle(P0,R, color=red, thickness=2), plot([P0], style=point, symbol=solidcircle, color=red, symbolsize=12), scaling=constrained);

[(1/2)*(x1^2*y2-x1^2*y3-x2^2*y1+x2^2*y3+x3^2*y1-x3^2*y2+y1^2*y2-y1^2*y3-y1*y2^2+y1*y3^2+y2^2*y3-y2*y3^2)/(x1*y2-x1*y3-x2*y1+x2*y3+x3*y1-x3*y2), -(1/2)*(x1^2*x2-x1^2*x3-x1*x2^2+x1*x3^2-x1*y2^2+x1*y3^2+x2^2*x3-x2*x3^2+x2*y1^2-x2*y3^2-x3*y1^2+x3*y2^2)/(x1*y2-x1*y3-x2*y1+x2*y3+x3*y1-x3*y2)], (1/2)*((x1^2-2*x1*x3+x3^2+(y1-y3)^2)*(x1^2-2*x1*x2+x2^2+(y1-y2)^2)*(x2^2-2*x2*x3+x3^2+(y2-y3)^2)/((y2-y3)*x1+(y3-y1)*x2+(y1-y2)*x3)^2)^(1/2)

 

[7/2, 3/4], (1/4)*205^(1/2)

 

 

 


 

Download Circumcircle.mw

3 4 5 6 7 8 9 Last Page 5 of 271