LeeHoYeung

Mr. Ho Yeung Lee

535 Reputation

10 Badges

12 years, 235 days

Social Networks and Content at Maplesoft.com

Seldom to ask question after retired math hobby Welcome August, February, July, May born girl And waited for her email to mavio@protonmail.com

MaplePrimes Activity


These are questions asked by LeeHoYeung

i got UI interface error when i install maple 15 into intel compute stick in window 8.1

after following a example , got error

 

                             2                  
               1   / d      \    1        2     2
               - m |--- x(t)|  - - m omega  x(t)
               2   \ dt     /    2              
Error, (in Mechanics:-LagrangeEqs) invalid input: subs received subst1, which is not valid for its 1st argument
Error, invalid input: Mechanics:-GeneralSol expects its 1st argument, eqs, to be of type list, but received eqs
Error, invalid input: rhs received sol, which is not valid for its 1st argument, expr
L;

 

Mechanics := module()
export SetVariables, LagrangeEqs, GeneralSol;
option package;
local subst1, subst2, varN, t;

SetVariables = proc( vars:: list, time )
local i;
t := time;
varN := nops( vars );
subst1 := {};
subst2 := {};
for i from 1 to var N do
subst1 := subst1 union
{vars[i](t) = q[i], diff(vars[i](t), t) = v[i]};
subst2 := subst2 union
{q[i] = vars[i](t), v[i] = diff(vars[i](t), t)};
end do;
print( subst1 );
print( subst2 );
NULL;
end proc;

LagrangeEqs := proc (L)
local i, l1, term1, term2;
l1 := subs(subst1, L):
for i to varN do
term1 := [seq(diff(subs(subst2, diff(l1, v[i])), t), i = 1..varN)]:
term2 := [seq(subs(subst2, diff(l1, q[i])), i = 1..varN)]:
end do;
[ seq(simplify(term1[i]-term2[i]) = 0, i = 1..varN) ];
end proc;

RayleighEqs := proc(L, R)
local i, l1, r1, term1, term2, term3;
l1 := subs( subst1, L ):
r1 := subs( subst1, R ):
for i from 1 to varN do
term1:=[seq(diff(subs(subst2, diff(l1, v[i])), t), i=1..varN)]:
term2:=[seq(subs(subst2, diff(l1, q[i])), i=1..varN)]:
term3:=[seq(subs(subst2, diff(r1, v[i])), i=1..varN)]:
end do:
[ seq(simplify(term1[i]-term2[i]+term3[i]), i=1..varN) ];
end proc;

LagrEqsII := proc( L, Q::list )
local i, l1, term1, term2;
l1 := subs(subst1, L):
for i to varN do
term1 := [seq(diff(subs(subst2, diff(l1, v[i])), t), i = 1 .. varN)]:
term2 := [seq(subs(subst2, diff(l1, q[i])), i = 1 .. varN)]:
end do;
[seq(simplify(term1[i]-term2[i]) = Q[i], i = 1 .. varN)];
end proc;

LagrEqsIII := proc (L, R, Q::list)
local i, l1, r1, term1, term2, term3;
l1 := subs(subst1, L):
r1 := subs(subst1, R):
for i to varN do
term1 := [seq(diff(subs(subst2, diff(l1, v[i])), t), i = 1 .. varN)]:
term2 := [seq(subs(subst2, diff(l1, q[i])), i = 1 .. varN)]:
term3 := [seq(subs(subst2, diff(r1, v[i])), i = 1 .. varN)]:
end do;
[seq(simplify(term1[i]-term2[i]+term3[i]) = Q[i], i = 1 .. varN)];
end proc;

GeneralSol := proc (eqs::list)
local i, initconds, eqs2;
initconds := NULL:
eqs2 := eqs[][]:
for i to varN do
initconds:=VarNames[i](0)=q[i], (D(VarNames[i]))(0)=v[i], initconds:
end do;
dsolve({initconds, eqs2});
end proc;


end module;

with(LibraryTools):
LibLocation := cat("c:\\Temp");
Save(Mechanics, LibLocation);
with(FileTools):
march('list',"c:\\Temp\\Mechanics.lib");
save(Mechanics, "c:\\Temp\\Mechanics.m");
read "c:\\Temp\\Mechanics.m";

 

with(Mechanics):
SetVariables([x], t);
L := (1/2)*m*diff(x(t), t)^2 - (1/2)*m*omega^2 * x(t)^2;
eqs := LagrangeEqs(L);
sol := GeneralSol( eqs );
X := unapply( rhs(sol), t );

 

 


(1,1,0), (0,0,0), (0,1,0)

1-0, 1-0, 0-0
0-0, 1-0, 0-0

with(LinearAlgebra):
m := Matrix([[i, j, k], [1, 1, 0], [0, 1, 0]]);
Determinant(m);
1*z = 0;

plot3d(z=0, x=0..1, z=0..1); #this can not plot

0*(x-0) + 0*(y-0) + 1*(z-0) = 0

would like to draw 3d rectangle in 3d plot with one formula

a system of monomials, which has 5 equations for 5 variables , have more than one solutions,

first solution is my wanted solution,

how to eliminate other unwanted solutions?

whether

1. add more equations to eliminate unwanted solutions? how to do?

or

2. edit existing system to eliminate unwanted solutions? how to do?

    a.  add extra terms to some equations?

 

what is the cause that make it having more than one solutions?

can this reason help to edit existing system?

 

i succeed with adding extra equation,a1+a2+a3+a4+a5-(6+s) =0  in 3 variables case, it calculate very fast within 1 second.

but when calculating 5 variables, it evaluating a very very long time, what is the problem

 

without extra equation a1+a2+a3+a4+a5+a6+a7-(1+2+3+4+5+s), it get result within 1 second, but after adding this extra equation, it is like dead loop,

my surface computer run with large fans noise and very hot.

restart;
H := subs(p=diff(f(q,P,t), q), 1/(2*m)*p^2 + 1/2*m*w^2*q^2) = -diff(f(q,P,t), t);
H:=subs( f(q,P,t) = f1(q) + f2(t), H);
sol:=dsolve({rhs(H)=E,lhs(H)=E});
S:=rhs(sol[1][1]+sol[1][2]);
subs(m=1, diff(S,q));
p := (E, w) -> -(1/2)*sqrt(-q^2*w^2+2*E)+(1/2)*q^2*w^2/sqrt(-q^2*w^2+2*E)-E*(sqrt(w^2)/sqrt(-q^2*w^2+2*E)+sqrt(w^2)*q^2*w^2/(-q^2*w^2+2*E)^(3/2))/(sqrt(w^2)*(1+w^2*q^2/(-q^2*w^2+2*E)));
lst := [seq(p((1/2)*E, w), E=0..5),seq(-p((1/2)*E, w), E=0 .. 5)]:
plot(lst, w= -3*Pi..3*Pi, color = black, numpoints=1000);

Q is the new coordinate which is diff(S,E)

t0 is the time when argument of solve(subs(m=1, diff(S,E))=0, t) vanish
initialq := solve(solve(subs(m=1, diff(S,E))=0, t)=0, q);

after find the initial value, how to plot with new coordinate?

dsolve({H, q=0}, f(q,P,t));

 

i try another way to do

 

restart;
H := subs(p=diff(f(q,P,t), q), 1/(2*m)*p^2 + 1/2*m*w^2*q^2) = -diff(f(q,P,t), t);
H:=subs( f(q,P,t) = f1(q) + f2(t), H);
sol:=dsolve({rhs(H)=E,lhs(H)=E});
S:=rhs(sol[1][1]+sol[1][2]);
p2 := subs(m=1, diff(S,q));

initialq := solve(solve(subs(m=1, diff(S,E))=0, t)=0, q);

H := subs(p=p2, 1/(2*m)*p^2 + 1/2*m*w^2*q^2) = -diff(f(t), t);
H := subs(w=theta(t), H);
sol := dsolve({H, q=0}, numeric, range = 0 .. 30);
odeplot(sol, [t, theta(t)], refine = 2);


Error, (in dsolve/numeric/process_input) invalid specification of initial conditions, got q = 0

 

First 63 64 65 66 67 68 69 Last Page 65 of 141