## 1580 Reputation

19 years, 260 days

## This may be the code:...

restart;
with(ListTools);
with(LinearAlgebra);

assign(
KTe = Matrix(3, 1),
KTe[1,1] = Matrix(4, 4, [[216, -288, -216, 288], [-288, 384, 288, -384], [-216, 288, 216, -288], [288, -384, -288, 384]]),
KTe[2,1] = Matrix(4, 4, [[216, 288, -216, -288], [288, 384, -288, -384], [-216, -288, 216, 288], [-288, -384, 288, 384]]),
KTe[3,1] = Matrix(4, 4, [[500, 0, -500, 0], [0, 0, 0, 0], [-500, 0, 500, 0], [0, 0, 0, 0]]),
DOFe = Matrix(3, 4, [[1, 2, 3, 4], [3, 4, 5, 6], [5, 6, 1, 2]])
);

KG := Matrix(3, 1): for k from 1 to 3 do nn:=Row(DOFe,k); KG1 := Matrix(6, 6); for i from 1 to 4 do for j from 1 to 4 do KG1[nn[i],nn[j]]:=(KTe[k,1])[i,j]; end do; end do; KG[k,1]:=KG1; end do:

print('KG' = KG);

## Use this:...

C := proc(E, T)
if type('E, T') then 1 elif hastype('E, T') then add(map(procname, [op]('E'), 'T')) else 0 fi;
end;

## Try:...

L := ifactors(10^128+3, easyfunc);
remove(type, L[2], [prime, posint]);

## Don't use convert, rational...

A := 3.123123;
L := convert(A, confrac, 'Ac');
Ac;
evalf(Ac[-3], 32);

B := 3.123123123123;
L := convert(B, confrac, 'Bc');
Bc;
evalf(Bc[-2], 32);

C := 7.421232323;
L := convert(C, confrac, 'Cc');
Cc;
evalf(Cc[-3], 32);

## Yes, use select....

A := {1, 2, 3, 4, 6, 8, 12, 17, 19, 20};
select(is, A , RealRange(5, 15));
select(proc(x, y, z) x>=y and z>=x end, A, 5, 15);

## Use FormalPowerSeries....

A := x*y/(y-x*sqrt(y)-x^2);
(simplify@@2)(A, [y = sq^2]) assuming sq>0;
A_PS := convert(%, FormalPowerSeries, x);
B := op(1, A_PS);
simplify(B) assuming sq>0, k, nonnegint;
subs(sq=sqrt(y), %);
;

## Simple collection method....

assign('Q = Q, R = R');
collect(collect(A, epsilon, Q), Q, proc(x) if type(x, identical(epsilon)^anything) then R(epsilon, op(2, x)) elif type(x, identical(epsilon)) then R(epsilon, 1) else x fi end);
seq(eval(P = coeff(%, P), [Q = (x -> x), R = ((x, y) -> x^y)]), P = sort([op@indets](%, 'R(identical(epsilon), anything)'), ((x, y) -> (op(2, x) < op(2, y)))));

## Use coeffs and member....

F := 2*y*sin(beta*x)+6*z*cos(beta*x)+24*sin(beta*x)*cos(beta*x):
W := coeffs(F, {sin, cos}(beta*x), 'V'):
[W], [V];
if member(sin(beta*x), [V], 'i') then op(i, [W]) else 0 fi;
if member(cos(beta*x), [V], 'i') then op(i, [W]) else 0 fi;

## Poor coding....

Replace relevant lines (from Eq3..Sols) with:
Eq3 := factor(expand(value(algsubs(subs(params, tr3), Eq2))))
Eq31 := collect(numer(lhs(Eq3)), exp(z))
sys1 := [coeffs(Eq31, exp(z)), c=c0];
vars := indets([sys1], name) minus {c0};
Sols := map(allvalues, [solve(sys1, vars)]); NSols := nops(Sols);

Alternatively you can try:
Eq3 := factor(expand(value(algsubs(subs(params, tr3), Eq2))))
vars := {c, mu, seq(a[i], i = -1 .. 1), seq(b[j], j = -1 .. 1)}
Sols := map(allvalues, [solve]({c=c0, identity(Eq3,z)},vars)); NSols := nops(Sols);

## ListTools[Categorize]...

Q:=proc(E)
local X;
if type(E, `+`) then X := [op]('E') else X := ['E'] fi;
ListTools:-Categorize(proc(x, y) lcoeff(x) = lcoeff(y) end, X);
end;
Q(pn);

## mhypergeom...

Have you tried looking at:

dsolve(ode, y(x), 'formal_solution', 'coeffs' = 'mhypergeom');

## Expand....

After You've assigned Leq add this line:
Leq := expand(Leq):

## Use sparsematrixplot....

Q:=map(x->`if`(type(x,even),1,0), LinearAlgebra:-RandomMatrix(3,3));
plots[sparsematrixplot](Q, matrixview);

 2 3 4 5 6 7 8 Last Page 4 of 21
﻿