Kitonum

21465 Reputation

26 Badges

17 years, 48 days

MaplePrimes Activity


These are answers submitted by Kitonum

Use the  fieldplot  command from the  plots  package. The grid option controls the number of arrows:

fieldplot(<a, b>, x = -100 .. 100, y = -100 .. 100, arrows = SLIM, grid = [10, 10]);

               

 

 

You can use the combinat:-partition command and then the  select  command to remove duplicate parts:

combinat:-partition(15,8):
select(t->nops(t)=nops({t[]}), %);

[[1, 2, 3, 4, 5], [2, 3, 4, 6], [1, 3, 5, 6], [4, 5, 6], [1, 3, 4, 7], [1, 2, 5, 7], [3, 5, 7], [2, 6, 7], [1, 2, 4, 8], [3, 4, 8], [2, 5, 8], [1, 6, 8], [7, 8]]

restart; 
f:=x->x^2-x+3:
g:=x->3*x-5:
solve(f(x)>=0 or f(x)<0);  # Finding the domain of the function f(x)
h:=f-g:
# Finding the range of the h(x)
m:=minimize(h(x), x=-infinity..infinity);
M:=maximize(h(x), x=-infinity..infinity);

                                            

So we have:  (-infinity, infinity)  is the domain of  f(x)[4, infinity)  is the range of  h(x) . Here we use the continuity of the function  h(x)  that takes all intermediate values between  and  M .

 

Use the  seq  command for this.
An example:

restart;
n:=7:
assign(seq(a[i]=i, i=1..n));
P:=piecewise(x<a[1],x, seq(op([x<a[k],(-1)^k*sqrt(0.5^2-(x-(k-0.5))^2)+1]),k=2..n), 1);
plot(P, x=-1..n+2, view=[-1..n+2,-1..2], scaling=constrained, size=[800,400]);

            

      

 

 

You can extract data from a plot using the  plottools:-getdata  command. The data is retrieved as a two-column matrix. See a simple example below:

restart;
plot([y^2,y, y=-1..1]);
plottools:-getdata(%);
%[3][1..10];

 

The integral must be introduced in the inert form:

restart;
A:=Int(exp(-4*tau)*sin(2*tau)/2, tau=0..t);
Student:-Calculus1:-ShowSolution(A);

Download Int.mw

It can be written much shorter using arrow-notation. We see that Maple finds this sum symbolically in a closed form. For large numbers N , this is much more efficient:

restart;
sum2N:=N->sum((N+k)^2, k=0..N);

# Examples
sum2N(N);
sum2N(10);

                

 

Alternative :

[seq(rhs~(t)[],t=[a])];

                  [-23, -12, -34, 87, 18, 98, 27, 93, 45, 68]

restart;
Sys := Y(t)=diff(y(t),t,t), diff(y(t), t, t)+y(t)*abs(y(t)) = 0; 
ic1 := y(0) = 1, D(y)(0) = 0; 
dsol1 := dsolve({Sys, ic1}, numeric, range = 0 .. 10);
plots:-odeplot(dsol1,[t,y(t)]); 
plots:-odeplot(dsol1, [t,diff(y(t),t)]);
plots:-odeplot(dsol1, [t,Y(t)]);

 

The  Picture  procedure is not suitable for your task. Use the built-in maple-procedure  plots:-inequal  for this:

restart;
plots:-inequal({x^2+y^2<=9,x^2+y^2>=4}, x = -4 .. 4, y = -4 .. 4, optionsfeasible = [color = yellow], optionsclosed = [color = brown, thickness = 3]);

                    

 

In fact, you are trying to find all 3 roots of the third degree of 1 in the complex domain. The shortest way to do this is to simply solve the equation  z^3=1 :

restart;
solve(z^3=1);

                             

 

That is the  LinearAlgebra:-MatrixExponential  command. See help for details on this command.

If you just type  a^3*sqrt(a);  Maple calculates it as  a^(7/2) . The desired display requires a special procedure. Procedure  P  displays an expression of the type  symbol^fraction  in the desired form.

P:=proc(p::symbol^fraction)
local e, a, n, k, m;
uses InertForm;
e:=op(2,p); a:=op(1,p);
n:=floor(e); k:=e-n; m:=surd(a^numer(k),denom(k));
`if`(n=0,m,`%*`(a^n,m));
Display(%,inert=false);
end proc:

Examples of use:

P(a^(7/2));
P(b^(8/3));
P(a^(2/5));

                                                

 

 

To avoid this bug, after differentiating with respect to  t  in the resulting series, you can simply write separately the term for k = 1 :

restart;
S:=Sum(epsilon^k*f[k](t)/k!, k=1..infinity);
S1:=diff(S, t);
S1:=eval(op(1,S1),k=1)+Sum(op(1,S1),k=2..infinity);
S2:=simplify(diff(S1,epsilon$2));

           

The first 5 terms of the series  S2 :

seq(eval(op(1,S2), k=n), n=2..6);

        

 

Figure shows a part of the surface inside a sphere of radius 4.5 :

restart;
with(plots):
x0 := x - Pi/4;
y0 := y - Pi/4;
z0 := z - Pi/4;
f := (x,y,z)->10*sin(x0)*sin(y0)*sin(z0) + 10*sin(x0)*cos(y0)*cos(z0) + 10*cos(x0)*sin(y0)*cos(z0) + 10*cos(x0)*cos(y0)*sin(z0) - 7/10*cos(4*x) - 7/10*cos(4*y) - 7/10*cos(4*z);
implicitplot3d(piecewise(sqrt(x^2+y^2+z^2)>4.5, undefined, f(x,y,z)-9),  x=-4.5 .. 4.5, y= -4.5 .. 4.5,  z=-4.5 .. 4.5, grid = [100, 100, 100], style = patchnogrid);

         

 

First 32 33 34 35 36 37 38 Last Page 34 of 290