Kitonum

20344 Reputation

26 Badges

16 years, 8 days

MaplePrimes Activity


These are answers submitted by Kitonum

If you want to simplify an expression using Maple, then you must follow the Maple syntax. In Maple, function arguments must be enclosed in parentheses:

G[ti] := -(v[r]*cos(theta)*cos(phi)+v[r]*cos(theta)*sin(phi)+v[r]*sin(theta)*rho)*(-c^2+(1-A)*(v[phi]^2+v[r]^2+v[theta]^2-(v[r]*cos(theta)*cos(phi))^2-(v[r]*cos(theta)*sin(phi))^2-(v[r]*sin(theta))^2))/(A*c^3)

-(v[r]*cos(theta)*cos(phi)+v[r]*cos(theta)*sin(phi)+v[r]*sin(theta)*rho)*(-c^2+(1-A)*(v[r]^2+v[theta]^2+v[phi]^2-v[r]^2*cos(theta)^2*cos(phi)^2-v[r]^2*cos(theta)^2*sin(phi)^2-v[r]^2*sin(theta)^2))/(A*c^3)

(1)

simplify(G[ti])

v[r]*((v[phi]^2+v[theta]^2)*A+c^2-v[phi]^2-v[theta]^2)*((sin(phi)+cos(phi))*cos(theta)+sin(theta)*rho)/(A*c^3)

(2)

``

Download metriccalculaions_new.mw

NumberOfOccurrences:=proc(d::nonnegint,N::posint)
local L;
uses ListTools;
L:=convert(N,base,10);
Occurrences(d,L);
end proc:


Examples of use:

NumberOfOccurrences(3,1345013);
NumberOfOccurrences(9,1345013);

                                             2
                                             0

1. I did not understand why such a cumbersome construction using the  StringTools  package and loops. This can be made much shorter:

L:="[ (0, 1), (1, 2), (1, 10), (2, 3), (3, 4), (4, 5), (4, 9), (5, 6), (6, 7), (7, 8),(8, 9), (10, 11), (11, 12), (11, 16), (12, 13), (13, 14), (14, 15), (15, 16)]":
L1:=parse(L):
{seq({L1[i],L1[i+1]}, i=1..nops(L1)-1, 2)};


2.  Of course, you can iterate a function of several variables, but the dimension of the function's domain must match the dimension of the domain of this function. For example

f:=(x,y)->(x^2-y^2,x^2+y^2):
(f@@2)(x,y);

 

This can be done programmatically without using palettes in 1D input:

`≈`(a, b);

                                       

 

Perhaps for a beginner, the option using vectors will be more understandable:

restart;
A, B, C := <-3, 1, 2>, <-2, -1, 1>, <0, 3, -3>;
alpha:=[2,-1,1];
G:=(A*alpha[1]+B*alpha[2]+C*alpha[3])/add(alpha);

 

I don't see any equation in your question ( p  is a procedure not an equation). If by equation you mean  p(v)=0  (finding the zeros of  ) , then simply multiply both sides of the equation  p(v)=0  by a common denominator:

restart;
p:=v->R*T/(v-b)-a/v^2;
Eq:=p(v)=0;
Eq1:=expand(simplify(Eq*(v-b)*v^2));

                                 

Using the matrix palette, in 2D mode insert the matrix you need, and then place the cursor at the right places and replace the square brackets with vertical lines. Maple realizes that this is now a determinant, and after pressing enter key, calculates it:

Probably this can be done in different ways. Below is one way:


 

restart; Sys := {T__1 = m__1*a, a = R*alpha, -R*T__1+R*T__2 = I__s*a/R, g*m__2-T__2 = m__2*a}; Var := {T__1, T__2, a, alpha}; Params := `minus`(indets(Sys), Var); Sol := solve(Sys, Var); T__1, T__2, a, alpha := seq(unapply(rhs(t), Params[]), t = Sol)

proc (I__s, R, g, m__1, m__2) options operator, arrow; R^2*g*m__2*m__1/(R^2*m__1+R^2*m__2+I__s) end proc, proc (I__s, R, g, m__1, m__2) options operator, arrow; m__2*g*(R^2*m__1+I__s)/(R^2*m__1+R^2*m__2+I__s) end proc, proc (I__s, R, g, m__1, m__2) options operator, arrow; R^2*g*m__2/(R^2*m__1+R^2*m__2+I__s) end proc, proc (I__s, R, g, m__1, m__2) options operator, arrow; R*g*m__2/(R^2*m__1+R^2*m__2+I__s) end proc

(1)

NULL



Here is another way in which variables and parameters are specified not by sets, but by lists. This allows us to maintain their order in the way we want, and not as Maple chooses:
 

restart; Sys := {T__1 = m__1*a, a = R*alpha, -R*T__1+R*T__2 = I__s*a/R, g*m__2-T__2 = m__2*a}; Var := [T__1, T__2, a, alpha]; Params := [R, m__1, m__2, g, I__s]; Sol := solve(Sys, Var)[]; T__1, T__2, a, alpha := seq(unapply(eval(Var[i], Sol), Params[]), i = 1 .. nops(Var)); T__1(1, 2, 3, 4, 5)

12/5

(1)

NULL


 

Download solveEqs_new2.mw

Download solveEqs_new1.mw

I'm used to always ending the line, the result of which should be displayed, end with a semicolon:       

# Using the Expression palette:

cos(5.);

# Using the Expression palette:

sqrt(4);
                            
# Using Command Completion:  

sqrt(4);
                             

Download No_Error.mw

restart:
  with(geometry):
  with(plots):
  _EnvHorizontalName = 'x':
  _EnvVerticalName = 'y':
   R := 5:
   ang := [3/4*Pi, -(3*Pi)/4, -Pi/6,4*Pi/9]:
   seq
   ( point
     ( `||`(P, i),
       [ R*cos(ang[i]), R*sin(ang[i])]
     ),
     i = 1 .. 4
   ):
   seq
   ( dsegment
     ( `||`(seg, i),
       [ `||`(P, i),
         `||`(P, irem(i, 4) + 1)
       ]
     ),
     i = 1 .. 4
   ):
   triangle(Tr1,[P1,P2,P4]):
   EulerCircle(Elc1,Tr1,'centername'=o1):
   triangle(Tr2,[P1,P2,P3]):
   EulerCircle(Elc2,Tr2,'centername'=o2):
   triangle(Tr3,[P3,P2,P4]):
   EulerCircle(Elc3,Tr3,'centername'=o3):
   triangle(Tr4,[P1,P3,P4]):
   EulerCircle(Elc4,Tr4,'centername'=o4):
   circle(cir, [point(OO, [0, 0]), R]):
   ngon1 :=[P1,P2,P3,P4]:

   poly1:=polygonplot(coordinates~(ngon1),color=blue,filled=true):
   ngon2 :=[P1,P2,P3,P4]:
   poly2:=polygonplot(coordinates~(ngon2),color=yellow,filled=true):
   display
   (draw
       ( [P1(color = black, symbol = solidcircle, symbolsize = 12),
           P2(color = black, symbol = solidcircle, symbolsize = 12),
           P3(color = black, symbol = solidcircle, symbolsize = 12),
           P4(color = black, symbol = solidcircle, symbolsize = 12),
           o1(color = black, symbol = solidcircle, symbolsize = 12),
           o2(color = black, symbol = solidcircle, symbolsize = 12),
           o3(color = black, symbol = solidcircle, symbolsize = 12),
           o4(color = black, symbol = solidcircle, symbolsize = 12),
           seg1,
           seg2,
           seg3,
           seg4,
           Tr1(color=green),Tr2(color=green),Tr3(color=green),Tr4(color=green),
           Elc1,Elc2,Elc3,Elc4,
           cir(color = blue)]
         
       ),
       textplot
       ( [ seq
           ( [ coordinates(`||`(P, i))[],
               convert(`||`(P, i), string)
             ],
             i=1..4
           )
         ,
         seq
           ( [ coordinates(`||`(o, i))[],
               convert(`||`(o, i), string)
             ],
             i=1..4
           )]
         ,
            
         align=[above, right]
       )
     ,
     axes=none
   );

                                        

restart;
with(geometry):
with(plots):
_EnvHorizont:lName = 'x';
_EnvVerticalName = 'y';
Vdot := proc(U, V) local i; add(U[i]*V[i], i = 1 .. 2); end proc;
R := 5;
ang := [3/4*Pi, -(3*Pi)/4, -Pi/6,4*Pi/9];
seq(point(`||`(P, i), [R*cos(ang[i]), R*sin(ang[i])]), i = 1 .. 4);
pts:=[seq(P || i,i=1..4)]:
seq(dsegment(`||`(seg, i), [`||`(P, i), `||`(P, irem(i, 4) + 1)]), i = 1 .. 4);
triangle(Tr1,[P1,P2,P4]);
EulerCircle(Elc1,Tr1,'centername'=o);
circle(cir, [point(OO, [0, 0]), R]);
dist := proc(M, N) sqrt(Vdot(M - N, M - N)); end proc;

display(draw([P1(color = black, symbol = solidcircle, symbolsize = 12), 
P2(color = black, symbol = solidcircle, symbolsize = 12), 
P3(color = black, symbol = solidcircle, symbolsize = 12), 
P4(color = black, symbol = solidcircle, symbolsize = 12),seg1,
seg2,seg3,seg4,Tr1,Elc1,
cir(color = blue)]), 
textplot([seq([coordinates(`||`(P, i))[], convert(`||`(P, i), string)],i=1..4)], align = [above, right]), axes = none);

 

I fixed some bugs in your code:

restart;
with(geometry):
with(plots):
_EnvHorizontalName = 'x':
_EnvVerticalName = 'y':
Vdot := proc(U, V) local i; add(U[i]*V[i], i = 1 .. 2); end proc:
R := 5:
ang := [2/3*Pi, -3*Pi*1/4, -Pi*1/6]:
seq(point(`||`(P, i), [R*cos(ang[i]), R*sin(ang[i])]), i = 1 .. 3):
seq(dsegment(`||`(seg, i), [`||`(P, i), `||`(P, irem(i, 3) + 1)]), i = 1 .. 3):
circle(cir, [point(OO, [0, 0]), R]):
dist := proc(M, N) sqrt(Vdot(M - N, M - N)); end proc:
display(draw([P1(color = black, symbol = solidcircle, symbolsize = 12), 
P2(color = black, symbol = solidcircle, symbolsize = 12), 
P3(color = black, symbol = solidcircle, symbolsize = 12), 
cir(color = blue)]), 
textplot([[coordinates(P1)[], "P1"], 
[coordinates(P2)[], "P2"], 
[coordinates(P3)[], "P3"]], align = [above, right]), axes = none);
                             

 

1. You are trying to plot a curve in space as the intersection of two implicitly defined surfaces. The plotting of such lines is based on sign changes. But in your example, these 2 surfaces only touch each other, i.e. no sign changes.
2. Lines in space are best plotted using the  plots:-spacecurve  command, in which the line is given by its parametic equations.

restart;
P1:=plots:-implicitplot3d( [x^2 + b*x + c=0 , b^2 - 4*c=0], b = -4..4, c = -4..4, x = -4..4, style=surface, color=["Green","Yellow"],grid=[50,50,50]):
P2:=plots:-spacecurve([b, b^2/4, -b/2], b = -4..4, color=red, thickness=5, view=[-4..4,-4..4,-4..4], labels=[b,c,x]):
plots:-display(P1, P2);

                                             

 

restart;
sol:=dsolve({diff(y(x),x,x)+2*diff(y(x),x)^2+8*y(x)=0, y(0)=0 , D(y)(0)=1}, numeric);
plots:-odeplot(sol,[x,y(x)], x=0..10);

                                      

 

restart;
for oo to 2 do
    M[oo] := InertForm:-Display(EI/L,inert=false)*(4*theta(oo) + 2*theta(oo + 1));
end do;

                                 

 

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