Kitonum

20514 Reputation

26 Badges

16 years, 84 days

MaplePrimes Activity


These are answers submitted by Kitonum


 

restart;
S := solve(x^2-2*x+1 > 0, x);
`union`(S);

S := solve(x^2-2*x+1 >= 0, x);
if S=x then convert(real, RealRange) fi;

S := solve(x^2-2*x+1 < 0, x);
if S=NULL then {} fi;

 

RealRange(-infinity, Open(1)), RealRange(Open(1), infinity)

 

`union`(RealRange(-infinity, Open(1)), RealRange(Open(1), infinity))

 

x

 

RealRange(-infinity, infinity)

 

 

{}

(1)

 


 

Download intervals.mw

restart;
l1:=<a,b,c>: l2:=<a,b,c>:
if LinearAlgebra:-Equal(l1, l2) then 
print("Equal Vectors");
end if:

# or
if andmap(t->t=0, l1-l2) then 
print("Equal Vectors");
end if:

To plot vectors, you can use the plots:-arrow command:


 

   
   

restart;
u:=[7,3]: v:=[2,-4]:
P1:=plots:-arrow([u,v], color=blue):
P2:=plots:-arrow(v,u-v, color=red):
plots:-display(P1,P2, scaling=constrained);

 

 


 

Download arrow.mw


 

restart

Sh := .5; R[d] := .7; alpha := (1/2)*Pi; Nc := .2; H := .4; `&epsilon;` := .4

"F(x):=(1+4*R[d])*diff(f(x),x$2)-Sh*sin(alpha)*f^(2)(x)-(Nc*(1-`&epsilon;`)+H)*f(x);"

proc (x) options operator, arrow, function_assign; (1+4*R[d])*(diff(f(x), `$`(x, 2)))-Sh*sin(alpha)*f(x)^2-(Nc*(1-epsilon)+H)*f(x) end proc

(1)

"f(x):=sum(a[i]*x^(i),i=0..3); "

proc (x) options operator, arrow, function_assign; sum(a[i]*x^i, i = 0 .. 3) end proc

(2)

"F(x):=(1+4*R[d])*diff(f(x),x$2)-Sh*sin(alpha)*f^(2)(x)-(Nc*(1-`&epsilon;`)+H)*f(x);"

proc (x) options operator, arrow, function_assign; (1+4*R[d])*(diff(f(x), `$`(x, 2)))-Sh*sin(alpha)*f(x)^2-(Nc*(1-epsilon)+H)*f(x) end proc

(3)

BCS := f(1) = 1, (D(f))(0) = 0

eq[1] := f(1) = 1; eq[2] := (D(f))(0) = 0; eq[3] := eval(F(x), x = 1) = 1; eq[4] := eval(diff(F(x), x), x = 0) = 0

a[0]+a[1]+a[2]+a[3] = 1

 

a[1] = 0

 

22.28*a[3]+7.08*a[2]-.5*(a[0]+a[1]+a[2]+a[3])^2-.52*a[1]-.52*a[0] = 1

 

22.8*a[3]-1.0*a[0]*a[1]-.52*a[1] = 0

(4)

p := fsolve({eq[1], eq[2], eq[3], eq[4]}, {a[0], a[1], a[2], a[3]})

{a[0] = .7342105263, a[1] = 0., a[2] = .2657894737, a[3] = 0.}

(5)

f := unapply(eval(f(x), p), x)

proc (x) options operator, arrow; .7342105263+.2657894737*x^2 end proc

(6)

"g(x):=0.7605263158+0.2394736842*x^2;"

proc (x) options operator, arrow, function_assign; .7605263158+.2394736842*x^2 end proc

(7)

plot([f(x), g(x)], x = 0 .. 1)

 

NULL

NULL


 

Download MSNL_new.mw

You must specify the coordinates of the center  c  and write down the parametric equations of the circle not in vector form, but coordinate-wise:

restart;
c:=[1,2]:
plots:-animate(plot, [[c[1]+r*cos(t),c[2]+r*sin(t),t=0..6.3], scaling=constrained],r=5..10);

If the number  n  is large, then finding all its divisors can take an unacceptably long time. In this case, a simple enumeration will be much more efficient. In the example below, we find all divisors of  n  that do not exceed the number  N .

restart;
n:=10^100+1: N:=10^6:
{seq(`if`(irem(n,k)=0,k,NULL), k=1..N)};

{1, 73, 137, 401, 1201, 1601, 10001, 29273, 54937, 87673, 116873, 164537, 219337, 481601, 642001}

I think it would be more useful for a beginner to solve these examples manually, rather than with Maple. If he still needs to solve with Maple, then it would be useful for a beginner to first master such important functions from the Maple core as diff , int , plot . It is also important to understand the difference between specifying a function with the  ->  (arrow) and using the  unapply  command. The solution below uses these tools:

restart;
# Example (a)
 f := x->1/x^2: 
 a := 1: b := 10:
 F := unapply(int(f(t),t=a..x), x) assuming x>a;
 diff(F(x),x);
 is(%=f(x)); # Check
 A := int(f(x), x=a..b);
 B := F(b) - F(a);
 is(A = B); # Check
plot([f, F], 1 ..10, color=[red,blue], legend=[f(x),F(x)]);

                   

 

Edit.  The number pi=3.14... should be coded in Maple as  Pi  not  pi  (in example (b)).

 

 

 

To solve this, we use vectors and a well-known formula that expresses the area of ​​a triangle through the coordinates of the vectors of its constituent sides:

restart;
local D:
A:=<0,0>: B:=<b,c>: C:=<a+b,c>: D:=<a,0>: 
AD:=D-A: DC:=C-D: M:=AD+2/5*DC: N:=(B+M)/2: BC:=AD:
BM:=M-B: AN:=N-A: 
area_AND:=1/2*LinearAlgebra:-Determinant(<AD | AN>):
area_BCM:=1/2*LinearAlgebra:-Determinant(<BM | BC>):
area_BCM/area_AND; 

                                   

First we set the coordinates of the points. Then we find the coordinates of the point  F  as the intersection of the lines  AC  and  EB . We find the area of ​​the triangle using the LinearAlgebra:-CrossProduct  command:

restart;
local D;
A, B, C, D, E := <0,0>, <0,b>, <a,b>, <a,0>, <a/2,0>:
solve({y=b/a*x, y=b-b/(a/2)*x}, {x,y});
F:=eval(<x,y>, %);
v1:=F-E; v2:=C-E;
v:=LinearAlgebra:-CrossProduct(<v1[1],v1[2],0>,<v2[1],v2[2],0>);
S:=1/2*sqrt(v[1]^2+v[2]^2+v[3]^2) assuming positive; # The area of the triangle EFC
simplify(S, {a*b=24}); # The answer

 

restart;

 

vars:=[x,y]:

k:=17:

expr:=-2*sqrt(118)*(((-4*x + y + 51/32)*sqrt(k) + (k*x)/4 - (51*y)/4 + 153/32)*sqrt(-4012 + 1003*sqrt(k)) + ((x + 4*y)*sqrt(k) - (85*x)/4 - (17*y)/4)*sqrt(4012 + 1003*sqrt(k)))*k^(1/4)/(17051*(-1 + sqrt(k)));

-2*118^(1/2)*(((-4*x+y+51/32)*17^(1/2)+(17/4)*x-(51/4)*y+153/32)*(-4012+1003*17^(1/2))^(1/2)+((x+4*y)*17^(1/2)-(85/4)*x-(17/4)*y)*(4012+1003*17^(1/2))^(1/2))*17^(1/4)/(-17051+17051*17^(1/2))

(1)

indets(expr);

{x, y}

(2)

factor(expr);

(1/64192)*(-4012+1003*17^(1/2))^(1/2)*118^(1/2)*17^(1/4)*(17^(1/2)+5)*(40*x-24*y-3)

(3)

op(factor(expr));

1/64192, (-4012+1003*17^(1/2))^(1/2), 118^(1/2), 17^(1/4), 17^(1/2)+5, 40*x-24*y-3

(4)

select(has, [op(factor(expr))], vars);

[40*x-24*y-3]

(5)
 

 

Download Download_2024-09-11_Has_Select_Question_new.mw

I think in Maple the most natural way to solve this particular problem is to use the  select  command:

restart;
L:=combinat:-permute([1,2,3,4]):
select(t->ListTools:-Search(2,t)<ListTools:-Search(3,t), L);

[[1, 2, 3, 4], [1, 2, 4, 3], [1, 4, 2, 3], [2, 1, 3, 4], [2, 1, 4, 3], [2, 3, 1, 4], [2, 3, 4, 1], [2, 4, 1, 3], [2, 4, 3, 1], [4, 1, 2, 3], [4, 2, 1, 3], [4, 2, 3, 1]]

Here is a simple calculation of the volume of this body and its drawing. Your body is like a torus. First we calculate the volume of this "torus" without a hole, and then simply subtract the volume of the hole. For drawing we use parametric equations of the surface of this body. For clarity, a cutout of 1/4 of the body is made.

restart;
f:=y->y^2-3: g:=y->y-y^2:
int(Pi*(2-f(y))^2, y=-1..3/2)-int(Pi*(2-g(y))^2, y=-1..3/2); # The volume of the solid
evalf(%);
M:=<cos(t),-sin(t); sin(t),cos(t)>:
P1:=plot3d([convert(M.<f(z)-2,0>, list)[1]+2, convert(M.<f(z)-2,0>, list)[2], z], t=-Pi/2..Pi, z=-1..3/2, color="Blue", scaling=constrained, axes=normal):
P2:=plot3d([convert(M.<g(z)-2,0>, list)[1]+2, convert(M.<g(z)-2,0>, list)[2], z], t=-Pi/2..Pi, z=-1..3/2, color="Red", scaling=constrained, axes=normal):
L:=plottools:-line([2,0,-2.9],[2,0,2.9], color=green, linestyle=3, thickness=2):
plots:-display(P1, P2, L, view=[-4.3..8.1,-6.1..6.1,-2.1..3.1]);

                   

 

To solve this, we can follow the plan:
1. Take a point M inside the pyramid - we can take any linear convex combination of the pyramid's vertices.
2. Find the projections of this point M1 and M2 onto the desired planes.
3. Find the angle alpha between the vectors MM1 and MM2.
4. The required angle is Pi - alpha.

restart;
local D:
with(Student:-MultivariateCalculus):
A, B, C, D, S :=  [0,0,0], [1,0,0], [1,1,0], [0,1,0], [0,0,1]:
p1, p2 := Plane(S,B,C), Plane(S,C,D):
M:=(A+B+C+D+S)/5;
M1:=Projection(M, p1);
M2:=Projection(M, p2);
v1:=convert(M1-M,Vector);
v2:=convert(M2-M,Vector);
Pi-Angle(v1,v2);  # The answer

                               

               

data[2 .. 3];

 

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