Kitonum

21435 Reputation

26 Badges

17 years, 25 days

MaplePrimes Activity


These are answers submitted by Kitonum

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. If we understand this problem as literally written "to find the supremum of the sequence of the function", then the task is trivial, because the limit function is 0 if  x<>0  and  1  if  x=0. Unfortunately, Maple incorrectly calculates the limit at the point  x=0 :

limit((x^2+4)/(2*x^2+(n*x+2)^2), n = infinity);

Output is 0
Should be  piecewise(x = 0, 1, 0) .

So the right answer is  1 .


Below, the less trivial problem is solved: to find the maximum of the function  f(x)  in the range  [1,infinity)  as a function of the parameter  n  (at first, looking at OP's code, I understood the problem in this very wording.).

2. Note that the correct command to find the maximum (symbolically) will be  maximize  not  maximum. It is obvious that Maple does not directly cope with this problem. Therefore, we present a manual solution in which all the calculations are done using Maple. The case n = 0 is obvious, because  we get an even function that decreases on the range  [1,infinity] . Therefore, the maximum value of the function in this interval is equal to  f(1). We show that in all other cases (n<0 or n>0) also the maximum value of the function on the range  [1,infinity] is equal to  f(1) . If  n<>0 , then the function always has 2 critical points, and if  n<0 , then both critical points are less than 1, and if  n>0 , then only one critical point is greater than 1. In the second case, the second derivative at this point is positive , so the function has a minimum at this point. Therefore, in all cases, it is enough for us to compare 2 values  f(1)  and  f(infinity) , and this is easily verified that  f(1)>f(infinity). So the final answer  is  f(1) = 5/(n^2+4*n+6) .


 

restart;

f:=x->(x^2+4)/(2*x^2+(n*x+2)^2);

proc (x) options operator, arrow; (x^2+4)/(2*x^2+(n*x+2)^2) end proc

(1)

maximize(f(x), x=1..infinity);
x1, x2:=solve(diff(f(x), x) = 0, x);
plot([x1,x2], n=-7..7, color=[red,blue]);
maximize(x2,location);
evalf(%);

maximize((x^2+4)/(2*x^2+(n*x+2)^2), x = 1 .. infinity)

 

(n^2+(n^4+6*n^2+1)^(1/2)+1)/n, -(-n^2+(n^4+6*n^2+1)^(1/2)-1)/n

 

 

-2+8^(1/2), {[{n = -1}, -2+8^(1/2)]}

 

.828427125, {[{n = -1.}, .828427125]}

(2)

simplify(eval(diff(f(x),x,x),x=x1));

2*(n^4+6*n^2+1)*((n^2+2)*(n^4+6*n^2+1)^(1/2)+n^4+5*n^2+2)*n^4/((n^4+5*n^2+2)*(n^4+6*n^2+1)^(1/2)+n^6+8*n^4+13*n^2+2)^3

(3)

simplify(eval(f(x),x=1)), limit(f(x), x=infinity);
minimize(%[1]-%[2], n=0..infinity, location);
plot([5/(n^2+4*n+6), 1/(n^2+2)], n=-10..10, color=[red,blue]);

5/(n^2+4*n+6), 1/(n^2+2)

 

0, {[{n = infinity}, 0]}

 

 

plot(eval(f(x),n=0), x=-10..10); # The case n=0

 

 


Edit.

Download maximize_new.mw

Expr:=(D@@2)(T)(0) + :-O(1) + 1/2*sin(1/2*Pi*T(x))^2 + 1/12*sin(1/2*Pi*T(x))*Pi*diff(T(x), x)*cos(1/2*Pi*T(x)) + :-O(2/3*(3/2*Pi^2*diff(T(x), x)*cos(1/2*Pi*T(x))^2*diff(T(x), x, x) - Pi^3*diff(T(x), x)^3*cos(1/2*Pi*T(x))*sin(1/2*Pi*T(x)) + sin(1/2*Pi*T(x))*Pi*diff(T(x), x, x, x)*cos(1/2*Pi*T(x)) - 3/2*sin(1/2*Pi*T(x))^2*Pi^2*diff(T(x), x, x)*diff(T(x), x))/Pi^2);
remove(has, Expr, O);

 

First 74 75 76 77 78 79 80 Last Page 76 of 289