Kitonum

13743 Reputation

24 Badges

11 years, 149 days

MaplePrimes Activity


These are answers submitted by Kitonum

on a simple example from a help:

restart;
with(plots): 
A := Matrix([[2, 1, 0, 0, 3], [0, 2, 1, 0, 0], [0, 0, 2, 1, 0], [0, 0, 0, 2, 1], [0, 0, 0, 0, 2]]);
S := [([1, 2, 3, 4, 5]=~StringTools:-Char~(96+~[$1..5]))[]];
sparsematrixplot(A, matrixview, tickmarks = [S, map(t->-lhs(t) = rhs(t) , S)]);

                                     

As far as I know, Maple does not implement a step-by-step solution of differential equations. However, you can find out the type of your equation, for example:

DEtools:-odeadvisor(diff(y(x),x)=(x^2+1)*sin(y(x)), y(x));

 Output:                          [_separable]


For details see help on  ?dsolve,details

Try the following, where  Expr  is your expression to be simplified. If this does not help, then upload your worksheet here.

map(simplify, Expr);


The  map  command forces the application of the  simplify  command separately to each operand of the expression.


Edit.

We see that the sequence  f1(k)  is the sequence of even numbers, starting with 2. Therefore, the sum of the corresponding series is equal to infinity:

H := r->piecewise(r < 1, 1, 0);
f1 := k-> sum(2*(1-H(j)), j = 0 .. k);
seq(f1(k), k=1..10);
expand(sum(2*k, k=1..n));
sum(2*k, k=1..infinity);

                             

 

 

 

If you need to plot a graph of the dependence of the real roots of the equation on a parameter, then it is not necessary to solve this equation first (this is not always possible explicitly). The easiest way to use the  plots:-implicitplot  command for this.
Below your example is solved in two versions: first in the range a in  0 .. 1 , and then in a wider range  a in  -0.5 .. 2.5. For the range  0 .. 1, we see that there are 2 roots close to 0 and one positive root, significantly superior to the first two:

restart;

A:=plots:-implicitplot(x^3+(a-3)^3*x^2-x*a^2+a^3 = 0, a=0..1, x=-1..30, color=red, grid=[100,20000], axes=box):
B:=plots:-implicitplot(x^3+(a-3)^3*x^2-x*a^2+a^3 = 0, a=0..1, x=-1..1, color=red, thickness=2, gridrefine=4):
plots:-display(< A | B >);

C:=plots:-implicitplot(x^3+(a-3)^3*x^2-x*a^2+a^3 = 0, a=-0.5..2.5, x=-100..100, color=red, thickness=2, gridrefine=3, axes=box):

plots:-display(C, B, size=[800,400]);

          

                      

Addition. In your problem it is interesting to find values of the parameter a , at which the number of real roots changes. Visually, these are 0 and 1.8 (approximately). Next, we find the exact values using the discriminant:

d:=discrim(x^3+(a-3)^3*x^2-x*a^2+a^3, x);
solve(d);
select(type, {%}, realcons);
evalf(%);

 The final results:                  
                  {0, -(1/6)*(324+12*sqrt(741))^(1/3)+2/(324+12*sqrt(741))^(1/3)+3}
                                                   {0., 1.786588337}

Classic worksheet exists only in 32 bit Maple version.

If a polynomial has degree greater than 4, then its roots in the general case are not expressed in radicals. In this case, you can use the  solve  command with subsequent selection of the roots (by select command) or the  Student:-Calculus1:-Roots  command, which immediately returns the real roots:


 

restart;

solve(x^6-3*x-5);
evalf([%]);
select(r->Im(r)=0, %);

# Or
Student:-Calculus1:-Roots(x^6-3*x-5, numeric);

RootOf(_Z^6-3*_Z-5, index = 1), RootOf(_Z^6-3*_Z-5, index = 2), RootOf(_Z^6-3*_Z-5, index = 3), RootOf(_Z^6-3*_Z-5, index = 4), RootOf(_Z^6-3*_Z-5, index = 5), RootOf(_Z^6-3*_Z-5, index = 6)

 

[1.451571465, .5973639664+1.275126159*I, -.7760033304+.9926461157*I, -1.094292737, -.7760033304-.9926461157*I, .5973639664-1.275126159*I]

 

[1.451571465, -1.094292737]

 

[-1.094292737, 1.451571465]

(1)

 


 

Download real_roots.mw

Since your equation allows a symbolic (analytical) solution, we first obtain this solution, and then look for a maximum at a suitable interval. I think that with the same Digits, this approach gives a more accurate result:

restart;
Eq := {diff(y(t), t, t) + 2*diff(y(t), t) + 4*y(t) = 0.9*sin(9*t), y(0) = 0, D(y)(0) = 0}:
Sol:=dsolve(Eq);
plot(eval(y(t),Sol), t=0..10);
Optimization:-Maximize(eval(y(t),Sol), t=0..1);
Digits:=25:
Optimization:-Maximize(eval(y(t),Sol), t=0..1);

     

 

value(Diff(x,x));

sum(diff(x^k,x)/k! , k=1..infinity);


diff( m(x+ diff(...) ...) / diff ?  Write the full code for this!

I do not  know  Adomian decomposition method. You can just use the  pdsolve  command for this:

pdsolve(diff(U(x,t), x, t) = U(x,t));

 

indets(P, function(identical(t)));

I understood the problem as follows. There are 10 questions and for each question a student can get a certain number of points from the set  {a, b, c, d} , where a, b, c, d  are integers in ascending order (the number  a  may be negative). Therefore, his final grade is determined by a list  [x1, x2, x3, x4]  in which x1 is the number of answers, in each of which he earned  points, x2  - b points  and so on. Should be  0<=xi<=10  and  x1+x2+x3+x4=10 .  Using the command for the number of compositions, we obtain an upper bound for the maximum number of distinct grades in the general case (the total 286) and for specific numbers  a, b, с, d . This method can be easily generalized to any number of questions and any set of possible points for 1 answer.

 

restart;
combinat:-composition(14,4):
S:=map(t->t-~1,%); # The set of all the conpositions of the number 10
nops(S); ``;
N:=map(p->p[1]*a+p[2]*b+p[3]*c+p[4]*d, S): # The set of grades

# Examples of use

eval(N,[a=0,b=1,c=2,d=3]);
nops(%); ``;
eval(N,[a=-1,b=1,c=2,d=3]);
nops(%); ``;
eval(N,[a=0,b=3,c=4,d=5]);
nops(%);

{[0, 0, 0, 10], [0, 0, 1, 9], [0, 0, 2, 8], [0, 0, 3, 7], [0, 0, 4, 6], [0, 0, 5, 5], [0, 0, 6, 4], [0, 0, 7, 3], [0, 0, 8, 2], [0, 0, 9, 1], [0, 0, 10, 0], [0, 1, 0, 9], [0, 1, 1, 8], [0, 1, 2, 7], [0, 1, 3, 6], [0, 1, 4, 5], [0, 1, 5, 4], [0, 1, 6, 3], [0, 1, 7, 2], [0, 1, 8, 1], [0, 1, 9, 0], [0, 2, 0, 8], [0, 2, 1, 7], [0, 2, 2, 6], [0, 2, 3, 5], [0, 2, 4, 4], [0, 2, 5, 3], [0, 2, 6, 2], [0, 2, 7, 1], [0, 2, 8, 0], [0, 3, 0, 7], [0, 3, 1, 6], [0, 3, 2, 5], [0, 3, 3, 4], [0, 3, 4, 3], [0, 3, 5, 2], [0, 3, 6, 1], [0, 3, 7, 0], [0, 4, 0, 6], [0, 4, 1, 5], [0, 4, 2, 4], [0, 4, 3, 3], [0, 4, 4, 2], [0, 4, 5, 1], [0, 4, 6, 0], [0, 5, 0, 5], [0, 5, 1, 4], [0, 5, 2, 3], [0, 5, 3, 2], [0, 5, 4, 1], [0, 5, 5, 0], [0, 6, 0, 4], [0, 6, 1, 3], [0, 6, 2, 2], [0, 6, 3, 1], [0, 6, 4, 0], [0, 7, 0, 3], [0, 7, 1, 2], [0, 7, 2, 1], [0, 7, 3, 0], [0, 8, 0, 2], [0, 8, 1, 1], [0, 8, 2, 0], [0, 9, 0, 1], [0, 9, 1, 0], [0, 10, 0, 0], [1, 0, 0, 9], [1, 0, 1, 8], [1, 0, 2, 7], [1, 0, 3, 6], [1, 0, 4, 5], [1, 0, 5, 4], [1, 0, 6, 3], [1, 0, 7, 2], [1, 0, 8, 1], [1, 0, 9, 0], [1, 1, 0, 8], [1, 1, 1, 7], [1, 1, 2, 6], [1, 1, 3, 5], [1, 1, 4, 4], [1, 1, 5, 3], [1, 1, 6, 2], [1, 1, 7, 1], [1, 1, 8, 0], [1, 2, 0, 7], [1, 2, 1, 6], [1, 2, 2, 5], [1, 2, 3, 4], [1, 2, 4, 3], [1, 2, 5, 2], [1, 2, 6, 1], [1, 2, 7, 0], [1, 3, 0, 6], [1, 3, 1, 5], [1, 3, 2, 4], [1, 3, 3, 3], [1, 3, 4, 2], [1, 3, 5, 1], [1, 3, 6, 0], [1, 4, 0, 5], [1, 4, 1, 4], [1, 4, 2, 3], [1, 4, 3, 2], [1, 4, 4, 1], [1, 4, 5, 0], [1, 5, 0, 4], [1, 5, 1, 3], [1, 5, 2, 2], [1, 5, 3, 1], [1, 5, 4, 0], [1, 6, 0, 3], [1, 6, 1, 2], [1, 6, 2, 1], [1, 6, 3, 0], [1, 7, 0, 2], [1, 7, 1, 1], [1, 7, 2, 0], [1, 8, 0, 1], [1, 8, 1, 0], [1, 9, 0, 0], [2, 0, 0, 8], [2, 0, 1, 7], [2, 0, 2, 6], [2, 0, 3, 5], [2, 0, 4, 4], [2, 0, 5, 3], [2, 0, 6, 2], [2, 0, 7, 1], [2, 0, 8, 0], [2, 1, 0, 7], [2, 1, 1, 6], [2, 1, 2, 5], [2, 1, 3, 4], [2, 1, 4, 3], [2, 1, 5, 2], [2, 1, 6, 1], [2, 1, 7, 0], [2, 2, 0, 6], [2, 2, 1, 5], [2, 2, 2, 4], [2, 2, 3, 3], [2, 2, 4, 2], [2, 2, 5, 1], [2, 2, 6, 0], [2, 3, 0, 5], [2, 3, 1, 4], [2, 3, 2, 3], [2, 3, 3, 2], [2, 3, 4, 1], [2, 3, 5, 0], [2, 4, 0, 4], [2, 4, 1, 3], [2, 4, 2, 2], [2, 4, 3, 1], [2, 4, 4, 0], [2, 5, 0, 3], [2, 5, 1, 2], [2, 5, 2, 1], [2, 5, 3, 0], [2, 6, 0, 2], [2, 6, 1, 1], [2, 6, 2, 0], [2, 7, 0, 1], [2, 7, 1, 0], [2, 8, 0, 0], [3, 0, 0, 7], [3, 0, 1, 6], [3, 0, 2, 5], [3, 0, 3, 4], [3, 0, 4, 3], [3, 0, 5, 2], [3, 0, 6, 1], [3, 0, 7, 0], [3, 1, 0, 6], [3, 1, 1, 5], [3, 1, 2, 4], [3, 1, 3, 3], [3, 1, 4, 2], [3, 1, 5, 1], [3, 1, 6, 0], [3, 2, 0, 5], [3, 2, 1, 4], [3, 2, 2, 3], [3, 2, 3, 2], [3, 2, 4, 1], [3, 2, 5, 0], [3, 3, 0, 4], [3, 3, 1, 3], [3, 3, 2, 2], [3, 3, 3, 1], [3, 3, 4, 0], [3, 4, 0, 3], [3, 4, 1, 2], [3, 4, 2, 1], [3, 4, 3, 0], [3, 5, 0, 2], [3, 5, 1, 1], [3, 5, 2, 0], [3, 6, 0, 1], [3, 6, 1, 0], [3, 7, 0, 0], [4, 0, 0, 6], [4, 0, 1, 5], [4, 0, 2, 4], [4, 0, 3, 3], [4, 0, 4, 2], [4, 0, 5, 1], [4, 0, 6, 0], [4, 1, 0, 5], [4, 1, 1, 4], [4, 1, 2, 3], [4, 1, 3, 2], [4, 1, 4, 1], [4, 1, 5, 0], [4, 2, 0, 4], [4, 2, 1, 3], [4, 2, 2, 2], [4, 2, 3, 1], [4, 2, 4, 0], [4, 3, 0, 3], [4, 3, 1, 2], [4, 3, 2, 1], [4, 3, 3, 0], [4, 4, 0, 2], [4, 4, 1, 1], [4, 4, 2, 0], [4, 5, 0, 1], [4, 5, 1, 0], [4, 6, 0, 0], [5, 0, 0, 5], [5, 0, 1, 4], [5, 0, 2, 3], [5, 0, 3, 2], [5, 0, 4, 1], [5, 0, 5, 0], [5, 1, 0, 4], [5, 1, 1, 3], [5, 1, 2, 2], [5, 1, 3, 1], [5, 1, 4, 0], [5, 2, 0, 3], [5, 2, 1, 2], [5, 2, 2, 1], [5, 2, 3, 0], [5, 3, 0, 2], [5, 3, 1, 1], [5, 3, 2, 0], [5, 4, 0, 1], [5, 4, 1, 0], [5, 5, 0, 0], [6, 0, 0, 4], [6, 0, 1, 3], [6, 0, 2, 2], [6, 0, 3, 1], [6, 0, 4, 0], [6, 1, 0, 3], [6, 1, 1, 2], [6, 1, 2, 1], [6, 1, 3, 0], [6, 2, 0, 2], [6, 2, 1, 1], [6, 2, 2, 0], [6, 3, 0, 1], [6, 3, 1, 0], [6, 4, 0, 0], [7, 0, 0, 3], [7, 0, 1, 2], [7, 0, 2, 1], [7, 0, 3, 0], [7, 1, 0, 2], [7, 1, 1, 1], [7, 1, 2, 0], [7, 2, 0, 1], [7, 2, 1, 0], [7, 3, 0, 0], [8, 0, 0, 2], [8, 0, 1, 1], [8, 0, 2, 0], [8, 1, 0, 1], [8, 1, 1, 0], [8, 2, 0, 0], [9, 0, 0, 1], [9, 0, 1, 0], [9, 1, 0, 0], [10, 0, 0, 0]}

 

286

 

``

 

{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30}

 

31

 

``

 

{-10, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30}

 

40

 

``

 

{0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50}

 

49

(1)
 

 


We see that in the second example the correct answer is 40 and not 41 (as in Carl's answer). The grade  -9  is not possible.

Download grade.mw

restart;
with(Student:-Precalculus):
P:=x^2 + y^2 - 2*x - y - 2 = 10;
P1:=lhs(P);
A:=CompleteSquare(P1, x);
op(1,A)+CompleteSquare(A-op(1,A), y)=rhs(P);

 

Edit. Here is another simpler way to get the desired order. In the list of variables, we indicate them in reverse order. This method works with more variables and with parameters. Unfortunately, he has the same drawback (indicated by acer), but we can do this without any zwischenzugs :

restart;
with(Student:-Precalculus):
P := x^2 + y^2 - 2*x - y - 2 = 10;
P1 := b*y+c*z^2/2+d*z-y^2-a*x-2+x^2 = 10;
CompleteSquare(P, [y,x]);
CompleteSquare(P1, [z,y,x]);

          

 

 

Third derivative of  y  by  x :

implicitdiff(y^2 = x^3+a*x+b, y, x$3);

restart;
dsolve(diff(f(x,y,z),z$2) = A - B*exp(-A*z), f(x,y,z));

                

Here  _F1  and  _F2  are arbitrary functions of  x  and  y .

1 2 3 4 5 6 7 Last Page 1 of 214