Kitonum

21475 Reputation

26 Badges

17 years, 49 days

MaplePrimes Activity


These are answers submitted by Kitonum

circles.mw
Procedure P solves the problem numerically. Formal arguments a, b are the lengths of the legs of a right triangle. The procedure returns a picture of the entire configuration for the user-specified values ​​of a and b. The global variable Sol stores the values ​​of all parameters of this configuration (points of contact, ellipse parameters, etc.):

restart;
P:=proc(a,b)
local R, h, F, s, c, V, F1, F2, G, c1, c2, Tr;
global Sol;
uses plots, plottools;

R:=proc(c,d)
local eq, eq1, eq2, dc;
eq:=(x-r)^2+y^2-r^2=0;
eq1:=c*cos(t); eq2:=d*sin(t);
dc:=implicitdiff(eq, y, x);
solve({eval(eq,[x=eq1,y=eq2]), diff(eq2,t)/diff(eq1,t)=eval(dc,[x=eq1,y=eq2])}, {r,t}, explicit);
eval(r,%[1]);
end proc:

h:=evalf(sqrt(a^2+b^2)):
F:=x^2/ a1^2+y^2/b1^2-1:  s:=b/sqrt(a^2+b^2): c:=a/sqrt(a^2+b^2):
V:=<c,s;-s,c>.<x-x0,y-y0>:
F1:=eval(F,[x=V[1],y=V[2]]):
F2:=solve(F1,y)[2]:
G:=(x+x4)^2+(y-x4)^2-x4^2:

Sol:=fsolve({eval(F1,[x=x1,y=0])=0,eval(implicitdiff(F1,y,x),[x=x1,y=0])=0,eval(F1,[x=x2,y=b/a*x2+b])=0,eval(implicitdiff(F1,y,x),[x=x2,y=b/a*x2+b])=b/a,eval(F1,[x=0,y=x3])=0,eval(implicitdiff(F1,x,y),[x=0,y=x3])=0,eval(G,[x=x5,y=eval(F2,x=x5)])=0,eval(diff(F2,x),x=x5)=eval(implicitdiff(G,y,x),[x=x5,y=eval(F2,x=x5)]),R(a1,b1)=x4},{a1=0..h/2,b1=0..b/2,x1=-a..-a/2,x2=-a..0,x3=b/2..b,x0=-a..0,y0=0..b,x4=0..b/2,x5=-a/2..0});

c1:=eval([x0,y0]+x4*[c,s],Sol):
c2:=eval([x0,y0]-x4*[c,s],Sol):

Tr:=curve([[0,0],[0,b],[-a,0],[0,0]], thickness=2);

display(Tr,implicitplot([eval(F1,Sol),eval(G,Sol),eval((x-c1[1])^2+(y-c1[2])^2=x4^2,Sol),eval((x-c2[1])^2+(y-c2[2])^2=x4^2,Sol)], x=-a..0, y=0..b, color=[blue,red,red,red],thickness=2, scaling=constrained, gridrefine=3), size=[800,500]);

end proc:


Examples of use:

P(2,1);
Sol;

                  


Using procedure P it is easy to trace how the configuration changes with the change in one of the parameters (b changes from 1 to 4):

plots:-animate(P,[a,1], a=1..4, frames=61, size=[800,500]);
               

In each of these two problems, the areas to be calculated are symmetrical about the horizontal axis. Therefore, it is sufficient to calculate only the halves of these areas, which are shaded in the pictures. The areas of these figures are easily found using the well-known formula for area in polar coordinates. It is more difficult to shade these areas. I have not found an easier way than replacing these areas with polygons with a sufficiently large number of sides. In the first problem, the area of ​​the entire figure is equal to twice the area of ​​the green figure. In the second problem, the area is equal to twice the sum of the areas of the pink and blue figures.

restart;
with(plots): with(plottools):
r1 := theta->-6*cos(theta):
r2 := theta->2-2*cos(theta):
r3 := theta->2+2*cos(theta):
t1:=solve(r3(theta)=3);
t2:=solve(r1(theta)=r2(theta));
P1:=plot([r1,r2], 0..2*Pi, color=[red,blue], thickness=2,coords=polar):
P2:=plot([3,r3], 0..2*Pi, color=[red,blue], thickness=2,coords=polar):
L:=line([0,0],[r1(t2)*cos(t2),r1(t2)*sin(t2)]):
Shade1:=polygon([seq([r3(s)*cos(s),r3(s)*sin(s)], s=0..evalf(t1),0.01),seq([3*cos(s),3*sin(s)], s=evalf(t1)..0,-0.01)], color="LightGreen"):
Shade2:=polygon([seq([r1(s)*cos(s),r1(s)*sin(s)], s=evalf(Pi/2)..evalf(t2),0.01),[0,0]], color=pink):
Shade3:=polygon([[0,0],[r2(t2)*cos(t2),r2(t2)*sin(t2)],seq([r2(s)*cos(s),r2(s)*sin(s)], s=evalf(2*Pi/3)..evalf(Pi),0.005)], color="LightBlue"):
display(P2,Shade1, scaling=constrained); # plot to the problem 1
display(P1,L,Shade2,Shade3, scaling=constrained); # plot to the problem 2
2*(1/2*int(r3(theta)^2-3^2, theta=0..t1)); # area of the region in the problem 1
evalf(%);
2*(1/2*int(r1(theta)^2, theta=Pi/2..t2)+1/2*int(r2(theta)^2, theta=t2..Pi)); # area of the region in the problem 2
evalf(%);

                             

                                                        

Download areas.mw

To calculate the hiker's coordinates, it is convenient to specify the points by the corresponding radius vectors. The problem is reduced to solving a system of two equations with 2 unknowns (the hiker is at point  ). The system may have several solutions, and to choose the right one, we check with the determinant that the shortest turns of the vectors  MS  and  MК  before aligning with the vectors MF and  MS  must occur counterclockwise. Procedure P returns the coordinates of the hiker (point M).

restart;
P:=proc(F::Vector,S::Vector,K::Vector,alpha,beta)
local M, Sol, a, b;
uses LinearAlgebra;
a:=evalf(alpha); b:=evalf(beta);
M:=<x,y>: 
Sol:=[solve({((F-M).(S-M))/sqrt((F-M).(F-M))/sqrt((S-M).(S-M))=cos(a),((K-M).(S-M))/sqrt((K-M).(K-M))/sqrt((S-M).(S-M))=cos(b)}, {x,y}, explicit)] assuming real;
select(t->Determinant(<eval(S-M,t) | eval(F-M,t)>)>0 and Determinant(<eval(K-M,t) | eval(S-M,t)>)>0, Sol)[];
end proc:


Example: calculation and visualization:

P(<1,2>,<3,4>,<7,1>,Pi/8, Pi/6);
M:=eval([x,y],%):
F:=[1,2]: S:=[3,4]: K:=[7,1]:
with(plots): with(plottools):
FS:=line(F,S,color=red): SK:=line(K,S,color=red):
MF:=line(M,F,linestyle=3,color=blue): MS:=line(M,S,linestyle=3,color=blue):
MK:=line(M,K,linestyle=3,color=blue):
T:=textplot([[F[],"F"],[S[],"S"],[K[],"K"],[M[],"M"]], font=[times,18], align={left,below}):
Points:=pointplot([F,S,K,M], color=[red$3,blue], symbol=solidcircle, symbolsize=15):
display(FS,SK,MF,MS,MK,T,Points, scaling=constrained);

                  

 

Let us denote by   the angle between the sides   and  . Using the law of cosines, we express the side  . By writing the doubled area of ​​the triangle in two ways, it is easy to find the height  h  dropped to  . Using the similarity of triangles, we find the side of the inscribed square  as a function of  .

restart;
a:=3: b:=4: 
c:=sqrt(a^2+b^2-2*a*b*cos(x)): 
h:=solve(h*c=a*b*sin(x), h);
d:=solve((h-d)/h=d/c, d); # The target function 
Optimization:-Maximize(d, {x>=0, x<=Pi}); # The answer

                      

Explanation: Triangle DBE is similar to triangle ABC with a similarity coefficient = BP/BQ

                           

 

The recursive procedure named  P  finds the list of values  x[n], y[n]  ​​for given  x0, y0, n .
As an example, the first 11 values ​​were found and the first 4 points were plotted:
 

restart;

P:=proc(x0,y0,n)
local Q;
option remember;
if n=0 then [x0,y0] else
Q:=P(x0,y0,n-1);
[Q[2]*Q[1]+2,(1/2)*Q[1]+Q[2]+1] fi;
end proc:

S:=seq(P(1,2,n), n=0..10):
A:=plots:-pointplot([S][1..4], color=red, symbol=solidcircle, symbolsize=15):
B:=plot([S][1..4], linestyle=3, color=blue):
plots:-display(A,B, view=[0..110,0..16]);

 

 


 

Download proc1.mw

Edited.


 

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

5 6 7 8 9 10 11 Last Page 7 of 290