Kitonum

21445 Reputation

26 Badges

17 years, 46 days

MaplePrimes Activity


These are answers submitted by Kitonum

You can use a set of any symbols (even spaces) as a name if you surround it with slanting quotes. Many years ago, I wrote a procedure to automatically check the work of my students, in which  chi^2 (Pearson's test) was used as a name. See examples below:

chi^2:=5;
`chi^2`:=5;
`My name`:=Yury;

      


See help on  ?Names  for details.

Here is 2 options to draw - in a for loop and as a table:

restart;
with(GraphTheory):
Graphs_data3:=[NonIsomorphicGraphs(6,restrictto =[connected], output
= graphs, outputform =graph)]:
Diameter2_select:=select[flatten](t->Diameter(t)=2,Graphs_data3):
nops(%);
for G in Diameter2_select do
DrawGraph(G);
od;
plots:-display(Matrix(12,5, [seq(DrawGraph(Diameter2_select[i]), i=1..59),plot(NULL, axes=none)]));
                               

 

Maybe OP wants to get the result written as a polynomial in the variable  x . This is easy to do, both symbolically (that is, exactly) and approximately:

collect(expand(convert(series(sin(x), x=1), polynom)), x);
evalf(%);
plot([sin(x), %], x=-1..3, color=[red,blue]);

The plot shows that in the range  [-1, 3]  the graphs  sin(x)  and the polynomial  almost the same.

A:=Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]):
B := Matrix(ListTools:-Reverse(convert(A, listlist)));

 

I understood the question that several separately created animations should simultaneously (in parallel) be reproduced on the same plot. To obtain the desired ranges in both axes, use the  view  option. Example below:

A:=plots:-animate(plot,[x^2, x=-2..a, color=red], a=-2..2, frames=60):
B:=plots:-animate(plot,[sin(2*x), x=0..a, color=blue], a=0..2*Pi, frames=60):
plots:-display(A, B, view=[-2..2*Pi, -1..4]);

   

 


If you are interested in various ways of combining several animations (parallel and sequential), then look at this post  https://www.mapleprimes.com/posts/207840-Combinations-Of-Multiple-Animations

Maple does not support the solution of symbolic matrix equations, even in the simplest case  A.X=B  when A is a invertible matrix. Similar equations can be solved in  LinearAlgebra  package only for specific  matrices  A  and  B .

restart;
N:=5:
A:=Matrix(N):
for i from 1 to N do
for j from 1 to N do
A[i,j]:=1/(i*j);
od: od:
A;

Of course, the same can be done in short:

A:=Matrix(5, (i,j)->1/(i*j));

 

restart;
simplify([a^4 + b^4 + c^4, a^5 + b^5 + c^5], {a+b+c=1, a^2+b^2+c^2=2, a^3+b^3+c^3=3});
solve({a+b+c=1, a^2+b^2+c^2=2, a^3+b^3+c^3=3});
evalf(%);

 

Here are the solutions:

# Question 1:
f:=x->x^3-2*x;
a:=0:  b:=2:
solve(f(b)-f(a)=D(f)(c)*(b-a), c);
evalf(%);

# Question 2:
g:=x->surd((x-3)^2, 3);
a:=-3:  b:=4:
solve(g(b)-g(a)=D(g)(c)*(b-a), c);
evalf(%);

In the first example of the two solutions obtained, we should select only the positive root.

Note that in the second example the point  c  does not belong to the interval   [-3,4] . The reason is that the function  g  is not differentiable at the point  x=3 . See the plots:

plot(f, 0..2);
plot(g, -3..4);

 

An arbitrary point inside the triangle you can get as a convex linear combination of its vertices. See  https://en.wikipedia.org/wiki/Convex_combination

For example:

restart; 

A := [1, 2, 3]; 
DD := [-2, 1, 0]; 
T := [1/2, 1/2, 3/2];

P:=1/3*A+1/3*DD+1/3*T;

P is the intersection point of the medians of this triangle.

In the real domain, this identity is also true for  x< 0 . Since  coth(x)*tanh(x)=1 , we will simply replace  1  in the expression  f  with  coth(x)^(1/3)*tanh(x)^(1/3) :

restart;
	
f:=(coth(x)^(1/3)-tanh(x)^(1/3))*(coth(x)^(2/3)+tanh(x)^(2/3)+coth(x)^(1/3)*tanh(x)^(1/3));

expand(f);
simplify(%);

   

restart;
Expr:=A*exp(-m*x)*cos(y)+B*exp(-m*x)*sin(y):
solve(identity(Expr,y), {A,B});
                                       
  {A = 0, B = 0}

The shape of the container can be very different. We restrict ourselves to the containers in the shape of a cuboid, and we will assume that length>=width>=height. The task is reduced to the factorization of the number 320 by 3 factors taking into account the conditions above. For this we use the procedure  Factoring  from this post  https://www.mapleprimes.com/posts/141668-Partitions-Of-A-Natural-Number-Into-Factors

ListTools:-Reverse~([map(t->[1,t[]],Factoring(320,2))[],Factoring(320,3)[]]);

[[160, 2, 1], [80, 4, 1], [64, 5, 1], [40, 8, 1], [32, 10, 1], [20, 16, 1], [80, 2, 2], [40, 4, 2], [32, 5, 2], [20, 8, 2], [16, 10, 2], [20, 4, 4], [16, 5, 4], [10, 8, 4], [8, 8, 5]]


This choise  [320,1,1]  is omitted for aesthetic reasons. Perhaps the first few variants (of those that remain) should also be discarded.

There are some problems with this code.

Here is an example with a hemisphere. In the case 1, there are many extraneous lines, in the case 2 the code does not work at all:

L:=[cos(x), sin(x)*cos(y), sin(x)*sin(y)]:
plot3d(L,x=0..Pi/2, y=0..2*Pi, scaling=constrained); # The surface 
ContoursWithLabels(L, 0..Pi/2, 0..2*Pi, {0.3,0.7,0.9}, [scaling=constrained]); # The case 1
ContoursWithLabels(L, 0..Pi/2, 0..2*Pi, [scaling=constrained]); # The case 2
 

You can get a good approximation period using best approximations  sqrt(2)  with rational numbers. See  https://en.wikipedia.org/wiki/Square_root_of_2  For example using  sqrt(2)=577/408  we get good approximation period  T=204*Pi .

Compare (in the third plot, the previous 2 ones are superimposed on each other.):

A:=plot((100+100*cos(6*t)+200 *cos(12*sqrt(2)*t))^2, t=0..3, color=red, size=[800,200]);  
B:=plot((100+100*cos(6*t)+200 *cos(12*sqrt(2)*t))^2, t=204*Pi..204*Pi+3, color=blue,size=[800,200]);
plots:-display(A,plottools:-translate(B,-204*Pi,0));  

 

 

 

First 88 89 90 91 92 93 94 Last Page 90 of 289