Kitonum

21845 Reputation

26 Badges

17 years, 229 days

MaplePrimes Activity


These are answers submitted by Kitonum

Here is the procedure which solves the problem for addition. For subtraction,multiplication and division everything is similar.

Plus:=proc(a,b)

local P;

uses ListTools;

P:=proc(a)

local s, n;

s:=convert(a, string);

n:=length(s);

add(parse(s[n-i+1])*2^(i-1), i=1..n);

end proc:

parse(cat(op(Reverse(convert(P(a)+P(b), base,2)))));

end proc:

 

Example of use:

Plus(1101, 111);

                                     10100

 

Edit. For multiplication:

Multiplication:=proc(a,b)

local P;

uses ListTools;

P:=proc(a)

local s, n;

s:=convert(a,string);

n:=length(s);

add(parse(s[n-i+1])*2^(i-1),i=1..n);

end proc:

parse(cat(op(Reverse(convert(P(a)*P(b),base,2)))));

end proc:

 

Example:

Multiplication(1101,1011);

                                                       10001111

Try  algsubs  command.

Example:

algsubs(y^4 = f(y),  x*y+x^3+y^5+y^6);

expand(%);

                           

 

 

Pink umbrella with its projection on xy-plane. Here is my attempt:

 

P := piecewise(x > -2 and x < -sqrt(2), sqrt(2)*(x+2)/(2-sqrt(2)), x > -sqrt(2) and x < 0, (2-sqrt(2))*x/sqrt(2)+2, x > 0 and x < sqrt(2), (sqrt(2)-2)*x/sqrt(2)+2, x > sqrt(2) and x < 2, sqrt(2)*(x-2)/(sqrt(2)-2)):

F := plots[spacecurve]([3*sin(theta), 0, 3*cos(theta)], theta = 0 .. arcsin(2/3), color = "DeepPink", thickness = 3, linestyle = solid):

Tr := p->plottools[rotate](p, (1/4)*Pi, [[0, 0, 0], [0, 0, 1]]):

Pr := plottools[polygon]([seq([2*cos((1/4)*Pi*k), 2*sin((1/4)*Pi*k), 0], k = 0 .. 8)], color = grey, style = surface):

A := plot3d(sqrt(-x^2-y^2+9), x = -2 .. 2, y = -P .. P, color = "HotPink", style = surface, scaling = constrained, axes = normal, numpoints = 5000, view = [-2.45 .. 2.45, -2.45 .. 2.45, 0 .. 3.45]):

C := plottools[cylinder]([0, 0, 1], 0.02, 2, style = surface, color = yellow): T := plots[tubeplot]({[0, 0, t, t = 0.7 .. 1], [0.2+0.2*cos(t), 0, 0.7-0.2*sin(t), t = 0 .. Pi]}, radius = 0.04, style = surface, color = brown):

plots[display](A, Pr, seq((Tr@@k)(F), k = 0 .. 7), C, T, axes = none);

 

                            

 

 Umbrella.mw

 

I did not find any command in Maple, which is plotting a vector field on a surface. But this is easy to do by hand, if you use plots[arrow]  command.

An example:

restart;

V := seq(seq(plots[arrow]([cos(phi)*sin(theta), sin(phi)*sin(theta), cos(theta)], [(1/5)*cos(phi)*cos(theta), (1/5)*sin(phi)*cos(theta), -(1/5)*sin(theta)], color = red), phi = 0 .. evalf(2*Pi), evalf(Pi/12)), theta = 0 .. evalf(Pi), evalf(Pi/12)):

S := plot3d(1, phi = 0 .. 2*Pi, theta = 0 .. Pi, style=surface, color = "LightBlue", coords = spherical):

plots[display](V, S, axes = normal, view = [-1.4 .. 1.4, -1.4 .. 1.4, -1.4 .. 1.4]);

 

                         

 

 

 We see that this vector field has singularities  at the poles.

 

You can just copy from Maple to Word. I think that this will be the easiest way.

Example:

plot3d(x^3-3*x*y^2, x = -1 .. 1, y = -1 .. 1, linestyle = solid);   # "Monkey" saddle

 

This is a screenshot of Word:

                 

a:=6*s*sqrt(9*s^2+32)+18*s^2+32:

S:=sqrt(9*s^2+32)=t:

a1:=simplify(algsubs(S^2, a)) assuming t>0;

subs(rhs(S)=lhs(S), factor(subs(-32=9*s^2-t^2, a1)));

                                        

 

 

 

If I understand the question, the slidable constants are some numerical parameters? If so, I have designated these parameters, as a, b, c. In the following examples spherical coordinates r, phi, theta were specified as some function of these parameters. 

This procedure plots down the appropriate space curve and AnimationOfCurve procedure animates this curve.

Curve := proc(Range, a, b, c)  # Range is the range for t

local R, Phi, Theta;

R:=r(t,a,b,c); Phi:=phi(t,a,b,c); Theta := theta(t,a,b,c); plots:-spacecurve([R*cos(Phi)*sin(Theta), R*sin(Phi)*sin(Theta), R*cos(Theta)], t = Range, color = red, thickness = 2, linestyle = solid, axes = normal, orientation = [10, 50]);

end proc:

 

AnimationOfCurve := proc(Range, a, b, c)

local R, Phi, Theta;

R := r(t, a, b, c); Phi := phi(t, a, b, c); Theta := theta(t, a, b, c); plots:-animate(plots:-spacecurve, [[R*cos(Phi)*sin(Theta), R*sin(Phi)*sin(Theta), R*cos(Theta)], t = lhs(Range) .. lhs(Range)+s, color = red, thickness = 2, linestyle = solid, axes = normal], s = 0 .. rhs(Range)-lhs(Range), frames = 90, orientation = [10, 50]);

end proc:

 

 

Examples of use:

r := (t, a, b, c)->a*cos(t)+b*sin(t)+c:

phi := (t, a, b, c)->a^2*cos(t)+(b-1)*sin(t)+c+1:

theta := (t, a, b, c)->a^3*cos(t)+(b^2-1)*sin(t)+c^2+1:

Curve(0..2*Pi,1,2,3);

                                      

 

AnimationOfCurve(0..2*Pi,1,2,3);

                                      

 

 

 

nombor1:=[4,6,2];

n:=nops(nombor1);

add(nombor1[i]*10^(n-i), i=1..n);

                                            

 

Addition:  The method is general in nature and can easily be written in the form of a procedure.

 

 

Use  plot3d  command instead of  plot  and unassigned variables  r  and  n :

plot3d(exp(-0.5*(r/sqrt((-r^2+1)/(n-2)))^2)/(sqrt((-r^2+1)/(n-2))*sqrt(2*Pi)), 'r' = 0.9 .. .1, 'n' = 4 .. 30, linestyle = solid, axes = normal, orientation = [-30, 70]);

                               

 

 

 

In Maple 2015 and 2016  linestyle=solid  option is required:

plot3d(x^2+y^2, x = -1 .. 1, y = -1 .. 1, linestyle=solid);

                           

 

 

 

 

 

Another way - not rewrite the system, but simply add extra equation in the original system:

eq1:=J*diff(theta(t),t,t)+b*diff(theta(t),t)=K*i(t):

eq2:=L*diff(i(t),t)+R*i(t)=V(t)-K*diff(theta(t),t):

eq3:=v(t)=diff(theta(t),t):

DCMotor:=[eq1,eq2,eq3];

plot([(x-1)/(x-2), [2, t, t = -5 .. 7], 1], x = -3 .. 7, -4 .. 6, color = [red, blue, blue], thickness = [2, 1, 1], linestyle = [1, 2, 2], discont, labels = [x, y]);

                             

 

 

The same plotting for the second plot. Here the horizontal asymptote is  y=2  not y=1

compoly  is an alternative command for these simplifications:

compoly(numer(f), {x,y});

                                                 x^3-36*z^2, x = 5*x+7*y

That is, we have the identity

numer(f)=subs(%[2], %[1]);

                125*x^3+525*x^2*y+735*x*y^2+343*y^3-36*z^2 = (5*x+7*y)^3 - 36*z^2

 

The same for the denominator.

I think it can be done in different ways. Here's one way as an example:

A:=`01101001`:

`+`(convert(parse(A), base, 10)[]);

                                    4

 For your example:

mylist:=[4,6,2]:

z:=map(convert, mylist, binary):

map2(nprintf, "%08d", z):

map(t->`+`(convert(parse(t), base, 10)[]), %);

                                  [1,2,1]

 

I did not find any mistakes. Just your function decreases very rapidly. It can be clearly seen, if you reduce the range for x-axis:

plot((11), x=0..1, y=0..0.4, labels=["x(m)","PDF(x)"], color=red,thickness=3 );

                                   

 

Addition:

plot((11),x=0..1, y=0..7, labels=["x(m)","PDF(x)"], color=red,thickness=3 );

                                    

 

 

 

 

First 193 194 195 196 197 198 199 Last Page 195 of 292