ComputerUser

535 Reputation

10 Badges

12 years, 205 days

Social Networks and Content at Maplesoft.com

Seldom to ask question after retired math hobby Just waiting for beauty who born in 1994 And waited for her email to mavio@protonmail.com What is the difference in ownership among different universe?

MaplePrimes Activity


These are replies submitted by ComputerUser

@vv 

so, what is the dorrect way to solve this?

@vv 

actually i have a equation which solve a very long time, it is like never end.

i observe the coefficient is so big, i do not know how to round this 

to make it faster, but i got error

how to solve these kind of big equation? 

 

https://drive.google.com/file/d/0Bxs_ao6uuBDUM25sR0VqWXotZnc/view?usp=sharing

read "C://Users//tester//Downloads//howtosolve.m":
Round := proc(x,n::integer:=1)
parse(sprintf(cat("%.",n,"f"),x));
end proc:

roundcoeffs1:=proc(p,x,n:=1) local t,c;
c:=map(Round, [coeffs(p,x,t)],n);
add(i, i = zip(`*`, c, [t]));
end:
roundcoeffs1(eigenvector1[1],[xx,x,y,z],3);
newvalue11 := solve(roundcoeffs1(eigenvector1[1],[xx,x,y,z],3) = newAB[1][1],xx):

 

 

@vv 

in maple 18 has error

Error, (in roundcoeffs1) invalid input: add expects 2 arguments, but received 1

 

@vv 

 

zip(`*`, [coeffs(p)], [seq(indets(p)[ii], ii=1..nops(indets(p)))])

indets is not suitable , because it is distinct and not original ordering

which way can have variable list that has original ordering

@vv 

when run in maple 18 got error, i would like to run in maple 15 and maple 18

if not use short code, what is normal way? 

 

Round := proc(x,n::integer:=1)
parse~(sprintf~(cat("%.",n,"f"),x));
end proc:

roundcoeffs:=proc(p,x)
local t;
add(Round~([coeffs(p,x,t)]) *~ [t]);
end:

p:=3.5*x^2+3.2*x-6.5+88.3*x*y-y^3+a*y:
roundcoeffs(p,[x,y]);

Error, (in roundcoeffs) invalid input: add expects 2 arguments, but received 1

 

@Carl Love 

first time to see that eliminate to use in this purpose.

@Kitonum 

i feel very excited. it is my first time to see this technique.

@Preben Alsholm 

Eigenvector has error true or false error when there is variable in matrix, when complex number, 

i have posted this error before, i still have not solved this problem yet

@Carl Love 

After thinking, i think your definition is correct

@Carl Love

what is the command simplify(fnormal~(B.B^*), zero); in maple 15?

my book use definition

G.[i].G[j] = 1 where i <> j

is this definition equivalent to the command simplify(fnormal~(B.B^*), zero); ?

 

 

tesleft@@Carl Love 

 

what is the syntax of simplify(fnormal~(B.B^*), zero);  in maple 15 ?

my book use

G[i].G[j]  = 1 where i <> j

is this definition same as the command simplify(fnormal~(B.B^*), zero); ?

@Kitonum 

if these are a set of harmonic oscillators c in summation(c*u)

will these harmonic oscillators change w and phi itself ?

i got questions about

1. they are invariant forever ?

2. they kept invariant over a fixed period time and change periodically ?

3. they always change for example time t and t+1 , w and phi already different ?

@Mac Dude 

it seems easy, i hope t1 and t2 are consecutively number 1 and 2, but actually it can be 3 and 4

these number can influence w and phi

how to choose these time number in better way in order to make w and phi time invariant?

@Doug Meade 

i mean from F = k*x

it can be written into four kinds of solutions

x(t) = A*sin(w*t+phi)

x(t) = alpha*cos(w*t) + beta*sin(w*t)

x(t) = exp(lambda*t)

x(t) = A*exp(i*w*t) - B*exp(-i*w*t)

 

but only x(t) = alpha*cos(w*t) + beta*sin(w*t)

and x(t) = A*sin(w*t+phi)

can be ploted into wave form

so, i am confused.

 

how to use maple to solve F=k*x into wave form solution?

as i see that dsolve solution expressed into exponential form

how to convert to cos(w*t)+i*sin(w*t), but this is only circle in complexplot

 

how can maple solve to 

x(t) = A*sin(w*t+phi)

and

x(t) = alpha*cos(w*t) + beta*sin(w*t) ?

 

@acer

the document i googled with mechanics-maple.pdf

http://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCMQFjAAahUKEwjZ95CK_fDIAhUhrKYKHQ-UDGI&url=http%3A%2F%2Futf.mff.cuni.cz%2F~scholtz%2Fdata%2Fmechanics-maple.pdf&usg=AFQjCNF8rEOSUNv1goQPjQdI4FB-UGarIg

after run some example from pdf , have one error and one of result is not the same as mentioned in document

 

Mechanics := module()
export SetVariables, LagrangeEqs, GeneralSol, SetMomenta, Hamiltonian, HamiltonEqs, GeneralHSol;
option package;
local subst1, subst2, substP, substPInv, varN, t, VarNames, Momenta;

SetVariables := proc (vars::list, time)
local i;
t := time;
VarNames := vars;
varN := nops(vars);
subst1 := {}; subst2 := {}; substP := {}; substPInv := {};
Momenta := NULL;
for i to varN do
subst1 := subst1 union {diff(vars[i](t), t) = v[i], vars[i](t) = q[i]};
subst2 := subst2 union {q[i] = vars[i](t), v[i] = diff(vars[i](t), t)};
substP := substP union {p[i](t) = p[i]};
substPInv := substPInv union {p[i] = p[i](t)};
Momenta := p[i], Momenta;
end do;
Momenta := [Momenta];
NULL;
end proc;

SetMomenta := proc (mom::list)
local i;
substP := {}; substPInv := {};
for i to varN do
substP := substP union {mom[i](t) = p[i]};
substPInv := substPInv union {p[i] = mom[i](t)};
end do;
Momenta := mom;
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;

Hamiltonian := proc (L)
local l1, momenta, H, subst3, i;
l1 := subs(subst1, L);
momenta := [seq(diff(l1, v[j]), j = 1 .. varN)];
subst3 := {seq(v[i] = solve(momenta[i] = p[i], v[i]), i = 1 .. varN)};
H := simplify(subs(subst3, sum(p[j]*v[j], j = 1 .. varN)-l1));
for i to varN do
H := subs({p[i] = Momenta[i](t), q[i] = VarNames[i](t)}, H)
end do;
H;
end proc;

HamiltonEqs := proc (H)
local i, eqs, h, s;
eqs := NULL;
h := subs(subst1, subs(substP, H));
s := subst2 union substPInv;
for i to varN do
eqs := eqs, diff(VarNames[i](t), t) = subs(s, diff(h, p[i])),
diff(Momenta[i](t), t) = -subs(s, diff(h, q[i]));
end do;
[eqs];
end proc;

GeneralHSol := proc( eqs ::list)
local i, initconds, eqs2;
initconds := NULL:
eqs2 := eqs[]:
for i from 1 to varN do
initconds :=VarNames[i](0)=VarNames[i][0],
Momenta[i](0)=Momenta[i][0],initconds:
end do;
dsolve( {eqs2, initconds} );
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";

restart;
read "c:\\Temp\\Mechanics.m";
with(Mechanics);
SetVariables([x], t);
SetMomenta([p]);
H := p(t)^2/(2*m)+(1/2)*m*omega^2*x(t)^2;
eqs := HamiltonEqs(H);
sol := GeneralHSol(eqs);

restart;
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.

Error, (in dsolve) not a system with respect to the unknowns {x(0)}
Error, invalid input: rhs received sol, which is not valid for its 1st argument, expr


restart;
read "c:\\Temp\\Mechanics.m";
with(Mechanics):
SetVariables([theta], t):
SetMomenta([p]);
L := (1/2)*diff( theta(t), t )^2 + cos(theta);
H := Hamiltonian(L);
eqs := HamiltonEqs(H);

2. this example is not diff(p(t), t) = -sin(theta);

 

First 19 20 21 22 23 24 25 Last Page 21 of 45