Kitonum

21660 Reputation

26 Badges

17 years, 179 days

MaplePrimes Activity


These are answers submitted by Kitonum

restart;
expr:=sqrt(4 + (-2*x - 2)*y):
content(expr)*primpart(expr);



Addition. It takes some extra effort to get the perfect result. Does anyone know how to make it shorter?

restart;
expr:=sqrt(4 + (-2*x - 2)*y):
content(expr)*primpart(expr);
applyop(collect, [2,1], %, y);
subs(y=-y, applyop(`/`, [2,1,2,1], %, -1));

                 

For greater clarity and informativeness, I made significant changes to the original code:

1. When creating complex animations, it's more convenient to first record one frame as a procedure and then use that procedure in the  plots:-animate  command.
2. Since the left half of the parabola isn't used in any way, I replaced it with the desired table.
3. I reduced the number of parameters to 7  (the number n runs through the values ​​from the list  [2, 4, 8, 16, 32, 64, 128]), but each subsequent parameter  n  is equal to twice the previous one.
4. The picture for each  n  lasts 1 second, since it's allocated 10 frames.


 

NULL

Approximation d'une intégrale

NULL

NULL

NULL

 

NULL

restart

with(Student:-Calculus1)

G := plot(x^2, x = 0 .. 2, gridlines, thickness = 3, color = "Blue")

OneFrame := proc (n) local P1, P2, L1, L2, T; P1 := RiemannSum(x^2, x = 0 .. 2, method = upper, output = plot, partition = n, caption = "", boxoptions = [filled = [color = "LightBlue"]]); P2 := RiemannSum(x^2, x = 0 .. 2, method = lower, output = plot, partition = n, caption = "", boxoptions = [filled = [color = "Red"]]); L1 := seq(plottools:-line([-1.9, k], [-.3, k]), k = 2.2 .. 2.8, .3); L2 := seq(plottools:-line([k, 2.2], [k, 2.8]), k = -1.9 .. -.3, .4); T := plots:-textplot([[-1.7, 2.65, "n"], [-1.3, 2.65, "Upper  \n sum"], [-.9, 2.65, "Lower  \n sum"], [-.5, 2.65, "Integral"], [-1.7, 2.35, n, font = [times, 18], color = blue], [-1.3, 2.35, evalf[4](RiemannSum(x^2, x = 0 .. 2, method = upper, partition = n)), font = [times, 18], color = blue], [-.9, 2.35, evalf[4](RiemannSum(x^2, x = 0 .. 2, method = lower, partition = n)), font = [times, 18], color = blue], [-.5, 2.35, evalf[4](int(x^2, x = 0 .. 2)), font = [times, 18], color = blue]], font = [times, 14]); plots:-display(P1, P2, L1, L2, T) end proc; plots:-animate(OneFrame, [n], n = `~`[`$`]([2, 4, 8, 16, 32, 64, 128], 10), background = G, paraminfo = false, size = [800, 800], gridlines = false)

   

 

 
 

     

Riemann_Anim_table_new.mw

Maple 2018.2 has the exact same bug.

Workaround:

restart;
ode:=diff(y(x),x) = 3*y(x)^(1/2)*x^(1/2); 
IC:=y(0)=2;
sol:=dsolve([ode,IC]);

                           

Another short way:

x := sqrt(sqrt(12)/(9 + sqrt(108))):
evala(x);

                             

restart;	
A:=r^(2*a)+r^2*(1+a+r^(2*a)) + r + a*r;
A1:=combine~(expand(A));
collect(A1,r);

               

We see that the  simplify command, given the same options but in different versions of Maple, can return different results. If we want to get the result we need, we need to be as clear as possible about what we want to Maple. We can generalize the original example as follows: suppose an expression contains only even-power cosines  and we need to replace them with sines. This can be done unambiguously using the Pythagorean trigonometric identity in the following form  cos(x)^2 = 1 - sin(x)^2 . The  algsubs  command is well suited for this task.

restart;
A:=sqrt(1-cos(x)^2):
B:=cos(x)^4*sin(x)^2+cos(x)^6:
MySubs:=cos(x)^2=1-sin(x)^2;
algsubs(MySubs, A);
algsubs(MySubs, B);

                         

 

You can use plots:-textplot  and   plottools:-line commands for this. Create the second legend yourself in the same way.

restart;
with(plots): with(plottools):
h:=z->1-(delta2/2)*(1 + cos(2*(Pi/L1)*(z - d1 - L1))):
K1:=((4/h(z)^4)-(sin(alpha)/F)-h(z)^2+Nb*h(z)^4):
T1:=Int(K1,z=0..1):
L1:=0.2: F:=10:
d1:=0.2:
T2:=evalf(T1):
T3:=unapply(T2,alpha,Nb,delta2):
T:=textplot([[0.037,4.18,"Color Representation",color=black],[0.04,4.14,"Nb=0.02",color=blue],[0.04,4.1,"Nb=0.03",color=red],[0.04,4.06,"Nb=0.04",color=green]], font=[times,bold,16]):
Lines:=line([0.033,4.14],[0.035,4.14],color=blue,thickness=10),line([0.033,4.1],[0.035,4.1],color=red,thickness=10),line([0.033,4.06],[0.035,4.06],color=green,thickness=10):
P:=plot([seq(seq(T3(alpha, Nb, delta2), Nb in [0.1, 0.2,0.3]), alpha in [Pi/6, Pi/4, Pi/3])], delta2 = 0.02.. 0.1,  titlefont = ["ROMAN", 15], labels = ["δ1", "T3"], labeldirections = ["horizontal", "vertical"], labelfont = ["SYMBOL", 11], linestyle = [solid, solid,solid,longdash, longdash,longdash, spacedash,spacedash, spacedash], symbol = [BOX, CROSS, CIRCLE, BOX, CROSS, CIRCLE, BOX, CROSS, CIRCLE], color = [blue,red, green, blue,red, green,blue,red, green], axes = boxed,size = [1000, 1000]):
plots:-display(P,T,Lines);



Download solution.mw

It seems Maple doesn't have a built-in procedure for constructing a vector field on a surface. However, if we know the parametric equations of the surface and the components of the vector field as functions of points on the surface, then using the  plots:-arrow command we can easily construct any number of field vectors.

In the example below, several vector field vectors are plotted on the unit sphere. In this example, all vectors are perpendicular to the surface and have a length of 1/4.

restart;
S:=plots:-display(plottools:-sphere(style=line, color=black, numpoints=400), axes=none):
L:=[sin(s)*cos(t),sin(s)*sin(t),cos(s)]:
F:=seq(seq(plots:-arrow(L, L/4, color=red), s=0..3.14,3.14/6), t=0..6.28,6.28/12):
plots:-display(S, F);

                      

 

 

Answer questions a) - e) easily manually (without Maple). 
Below is an animation of the trajectories and velocity vectors of these yachts:

restart;
P:=proc(t)
local Tr1, Tr2, Ya1, Ya2, V1, V2, v;
uses plots, plottools;
Tr1:=plot([4+3*s,5-4*s,s=0..t], color=red, thickness=3);
Tr2:=plot([1+8*s,-8+6*s,s=0..t], color=blue, thickness=3);
Ya1:=disk([4+3*t,5-4*t],0.4, color=red);
Ya2:=disk([1+8*t,-8+6*t],0.4, color=blue);
V1:=arrow([4+3*t,5-4*t],[3,-4], width = [0.08, relative], head_length = [0.2, relative], color=red);
V2:=arrow([1+8*t,-8+6*t],[8,6],  width = [0.04, relative], head_length = [0.1, relative], color=blue);
v:=textplot([[4+3*t+3,5-4*t-4,v1,align=[right,above]],[1+8*t+8,-8+6*t+6,v2,align=[right]]], font=[times,bold,16]);
display(Tr1,Tr2,Ya1,Ya2,V1,V2,v);
end proc:

plots:-animate(P,[t], t=0..4, frames=40, scaling=constrained, size=[600,600]);

We can easily find the general solution to this problem (not just the smallest solution) if we use the  isolve  command. The notation and the beginning are the same as vv's ones.

restart;
sol:=isolve(10*u+7=(7*10^n+u)/3); # General solution for _Z1::nonenegint
eval(sol, _Z1=0);
eval(k=7*10^n+u, %); # Smallest solution

             

Since the value of each variable obviously does not exceed 637, the simplest enumeration in a double loop in a couple of seconds gives all 8 solutions:

restart;
for x from 0 to 637 do
for y from 0 to 637 do
if sqrt(x)+sqrt(y)=sqrt(637) then print({'x'=x,'y'=y}) fi;
od: od: 

                                          

The last line should be:

plots[odeplot](soln, [[t, r(t)], [t, varphi(t)]]);

The task is not difficult and comes down to solving a simple equation:

restart;
# A is the center of one of the circles k3
A:=<1+r,0>: B:=<sqrt(2)*cos(Pi/5),sqrt(2)*sin(Pi/5)>:
# The distance between the points A and B must be equal r
sqrt((B-A).(B-A))=r assuming real; 
r:=solve(%);
rationalize(r);
expand(%);
evalf(%);

# Visualization

with(plots): with(plottools):
k1:=circle(color=blue): k2:=circle(sqrt(2), color=green):
k0:=circle([1+r,0],r, color=red):
k3:=seq(rotate(k0,2*Pi*i/5), i=0..4):
display(k1,k2,k3);

                  

 

The reason Maple doesn't fully expand the parentheses is because you forgot to put a multiplication sign between the parentheses in the middle term. If you want Maple to write the resulting two-variable  с  and   polynomial as a one-variable  m  polynomial, you should use the  sort  command:

If you omit this multiplication sign, as you did, Maple interprets this entry in the middle term as calling the sum of two functions  5/2 (constant function)  and 12 c  applied to the argument m-1/2, followed by squaring.

Another example of a function call:

(a+3*b+4)(c+d);

                     

 

You forgot to put the multiplication sign between the brackets in the middle term.

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