Kitonum

21011 Reputation

26 Badges

16 years, 187 days

MaplePrimes Activity


These are answers submitted by Kitonum

To draw circular arcs in 3D you can use the  plots:-spacecurve  command. I also made your code more compact by using the  map  command and multiple assignments. This allowed us to remove a lot of repetitions.

restart;
with(plots): with(plottools): with(geom3d):
Con := cone([0, 0, -2], 0.7, 2, transparency = 0.8, color = "SpringGreen"):
map(point@op, [[A, 0, 0, 0], [B, 0, 0, -2], [C, 0.7, 0, 0]]):
S1, S2, S3 := map(segment@op, [[AB, [A, B]],[AC, [A, C]],[BC, [B, C]]])[]:
G := draw([S1, S2, S3], linestyle = [dash,dash,solid], color = red, thickness = 2):
l := textplot3d([[0, 0, 0, "A", align=right],[0, 0, -2, "B",align=right],[.8, 0, 0, "C",align=left]], font=[times, bold, 20]):
P := plottools:-point(coordinates~([A,B,C]), color=blue, symbol=solidsphere, symbolsize = 14):
Arc1:=spacecurve([0.7+0.35*cos(t),0,0.35*sin(t)], t=-Pi..-Pi/2-arctan(0.7/2), color=red, thickness=2):
Arc2:=spacecurve([0.4*cos(t),0,-2+0.4*sin(t)], t=arctan(2/0.7)..Pi/2, color=red, thickness=2): 
G0:=textplot3d([[0.06, 0, -1.65, alpha, font=[times, bold, 16], color = red], [0.5, 0, -0.1, typeset(`#msup(mn("67"),mo("°"))`), font=[times, bold, 15], color = red]]):
display(Con, G, l, P, G0, Arc1, Arc2, scaling = constrained, orientation = [45, 70], view=[-0.8..0.8,-0.8..0.8,-2.1..0.1], axes=none);

                           

 

 

Should be assign instead of assigne.

restart;
x := rand(0. .. 1.)();                        
y := x+f(x):
subsindets(y, numeric, evalf[4]);
evalindets(y, numeric, evalf[4]);

Use  add  instead of sum:

restart;
B := (n, i, p) -> binomial(n, i)*(p^i)*(1-p)^(n-i)/i;
F:=(n,p)->add(B(n,i,p),i=1..n);
F(2,1);

I understood this as multiplying the inverse of a matrix by a vector, since in a cross  product both factors must be vectors. To multiply a matrix by a vector, an ordinary point is used:

restart;
xA := 4;
yA := 10;
xB := 0;
yB := 0;
xC := 13;
yC := 0;
Mat := Matrix(3, 3, [xA, xB, xC, yA, yB, yC, 1, 1, 1]);
phi := (x, y) -> Mat^(-1).<x, y, z>;
phi(4, 18/2);
phi(4, 10);
phi(13, 0);

 

You forgot the multiplication signs:

restart;
factor(a^2+2*a*b+b^2); 
sqrt(a^2+2*a*b+b^2);
sqrt(a^2+2*a*b+b^2) assuming a+b>=0;
sqrt(a^2+2*a*b+b^2) assuming a+b<0;

 

In the solution below, Pascal's triangle has a more traditional form:

restart;
for n from 0 to 7 do
print(cat(seq(cat(`   `,binomial(n,k),`   `), k=0..n)));
od:

                           

 

Example a) 
Let  the points E(1,0), F(0,1), G(0,3), H(3,0). The Green's Theorem 
{\displaystyle \oint \limits _{C}(P\,dx+Q\,dy)=\iint \limits _{D}\left({\frac {\partial Q}{\partial x}}-{\frac {\partial P}{\partial y}}\right)\,dx\,dy}

restart;
with(VectorCalculus):
SetCoordinates(cartesian[x, y]):
P:=x^2*y: Q:=x*y^2:
I1:=LineInt(VectorField(<P, Q>), Path(<cos(t), sin(t)>, t=0..Pi/2)): # Integration along the EF curve
I2:=LineInt(VectorField(<P, Q>), Path(<0,t>, t=1..3)): # Integration along the FG curve
I3:=LineInt(VectorField(<P, Q>), Path(<3*cos(t),3*sin(t)>, t=Pi/2..0)): # Integration along the GH curve
I4:=LineInt(VectorField(<P, Q>), Path(<t,0>, t=3..1)): # Integration along the HE curve
A:=I1+I2+I3+I4; # Left side of Green's formula
B:=int(eval((diff(P,y)-diff(Q,x))*r, [x=r*cos(t),y=r*sin(t)]), [r=1..3, t=0..Pi/2]); # Right side of Green's formula


Example b) can be solved similarly.

Examples:

restart;
L:=[a,b,c,d]:
L1:=map(t->t$3, L);
combinat:-permute(L1, 3);
nops(%);
combinat:-choose(L1, 3);
nops(%);

 

 

I think you are working in the real domain. So

restart;
is(-ln(1/c)=ln(c)) assuming c>0;

                                                 true

You can easily do this using the  InertForm  package:

restart;
b := Matrix(3, 6, [[-1/2, 0, 1/2, 0, 0, 0], [0, 0, 0, -1/2, 0, 1/2], [0, -1/2, -1/2, 1/2, 1/2, 0]]);
InertForm:-Display((1/2)%*(2*b), inert=false);

                                 

 

To plot arrows at the ends of the axes, as well as for labels for the axes (near the ends of the axes), you can use the tools of the  plots  package:

restart;
with(plots):
y:=x->1/abs(x):
arrow_x:=arrow([4.7,0],[0.01,0], width=0, head_width=0.2, head_length=0.3, shape=arrow):
arrow_y:=arrow([0,5.7],[0,0.01], width=0, width=0, head_width=0.3, head_length=0.2, shape=arrow):
label_x:=textplot([4.5,-0.3,"x"], font=[times,bold,16]):
label_y:=textplot([-0.5,5.5,"y"], font=[times,bold,16]):
display(plot(y, -4.7..4.7, -0.7..5.7, color=red, thickness=2), arrow_x, arrow_y, label_x, label_y);

                               

 


To avoid labels for the axes that Maple builds by default, we used the operator form of specifying the function  plot(y, -4.7 .. 4.7, ... )

Edited.

Maple already has such a built-in procedure called the  combinat:-randperm  (random permutation).

Example of use:

restart;
randomize():
n:=70: m:=30:
combinat:-randperm([1$n, 0$m]);

 [1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0]

As a possible alternative to the  surd  command, you can call the RealDomain package first:

restart;
with(RealDomain):
plot(x^(1/3), x=-10..10);

 

A linear polynomial  x - (-8.0)^(1/3)  has a single root. It is called the principal value of a root. To find all the roots (numerically and symbolically) do

fsolve(x^3-(-8.0), complex);
solve(x^3-(-8));

                                  -2., 1.-1.73205080756888*I, 1.+1.73205080756888*I
                                           -2, 1-I*sqrt(3), 1+I*sqrt(3)

First 7 8 9 10 11 12 13 Last Page 9 of 286