## 12785 Reputation

8 years, 318 days

## Reduce...

Reduce(X,X,T) is useless, it will produce only zeros.

If you want to see if a polynomial p in X is dependent of the other ones, you should call Reduce versus the rest of the polynomials i.e.

Reduce(p, Xp, T)
where
Xp := convert( convert(X,set) minus {p}, list );
Actually you should use a Groebner basis for Xp, otherwise the reduction could be incomplete (so, irrelevant).

## "generic"...

In many situations Maple gives "generic" solutions.
For example, solve(a*x-2*a,x)  ==> x=2  (ignoring the case a=0).
However,  solve(a*x-2*a);  ==> {a = a, x = 2}, {a = 0, x = x}.
Your system has many equations of the form  a*b+c*d = 0.
solve([a*b+c*d]); ==> {a = -c*d/b, b = b, c = c, d = d},  so the solutions having b=0 are lost.

In such situation it is safer to use the Groebner package but unfortunately the system is too big for this.

## same...

They are the same, because in Sample(X,n), X can be a distribution (as in your first case) or a random variable (the second case).

## zero...

Maple has difficulties because the integrand is discontinuous, symbolic and the zeros in [0,2*Pi] of
h := a*cos(t+b)+sin(t+c);
cannot be found easily in terms of a,b,c.

If you want the integral for numeric values of a,b,c, use numerical integration:
int(  eval(signum(h),[a=1,b=2,c=3]), t=0..2*Pi, numeric);

But a little math helps to see that the integral is always 0 for real a,b,c.
In fact, h can be written as
h = c*cos(t) + d*sin(t), or
h= c*sin(t+d);
Now, h is 2Pi-periodic, so
int(signum(c*sin(t+d)), t=0..2*Pi) = int(signum(c*sin(t)), t=0..2*Pi) = signum(c)* int(signum(sin(t)), t=0..2*Pi)=0.

Edit. corrected typo: abs to signum

## Bits...

with(Bits):
bits:=Join([1,0,0,0,0,0,0,0]):
text:=Join([1,1,1,1,0,0,1,1]):
Xor(bits,text):
Split(%,'bits'=8);  #flip positions
[0, 1, 1, 1, 0, 0, 1, 1]
5

## list?...

You probably want a list.

m:=Matrix([[0,1,0,1,0,1,0]]);

convert(m,list);
[0, 1, 0, 1, 0, 1, 0]

## parametric...

T := 2*cos(4*w):
E := sin(3*w):
plot( [E,T, w=0..2*Pi]);

## freeze...

eq1a:=subs(rhs(eq1)=freeze(rhs(eq1)),eq1):
eq2a:=subs(rhs(eq2)=freeze(rhs(eq2)),eq2):
solve({eq1a,eq2a},{a,e}):
thaw(%);

## Parametrization...

Maple cannot obtain a rational parametrization for curve(alpha,beta)=0, because the genus is not 0.

But, being quadratic in alpha, a parametrization can be easily obtained by solving wrt alpha.

Let's take a simpler example, to see easier the results.

ec:= (u,v) -> u^2-u+3*v^3-v-2:  # the curve is ec(u,v)=0
# choose a point on it
u0:=0.6:
v0:=fsolve(ec(u0,v),v);

vv:=v0+z^2:   # choose v as you wish
solve(ec(u,v),u);   # find parametrization for u  (exact)

eval(%[1],v=vv);   # choose the desired branch
uu:=series(%,z,8):  # obtain the approx parametrization
u=uu,v=vv;   # Parametrization near (u0,v0)

## Simple but slow...

Here is a very simple one. Unfortunately it's slow for n>11.
But it is very fast for n=1  and n=2  (mod 4)    :-)

LangfordSeq:=proc(n::posint)
local A,B,C,C1,z,i:=irem(n,4),j,s,S, V:=Vector(2*n);
if i=1 or i=2 then return "Solutions exist only for n = 0 or 3 (mod 4)" fi;
C:= seq(seq(z[i,j]=z[i+n,i+j+1], j=1..2*n-i-1), i=1..n);
C1:= seq(seq(z[i,j]=0, j=2*n-i..2*n), i=1..n);
s:=Optimization:-LPSolve(0,{A,B,C,C1},assume=binary);
S:=eval(Matrix(2*n,symbol=z), s[2]);
for i to n do for j to 2*n do
if S[i,j]=1 then V[j]:=i; V[j+i+1]:=i; fi od;od:
convert(V,list);
end:

LangfordSeq(7);

## Maths...

In such problems maths always beats a CAS.

f:=x -> x^4+c*x^2+x^3+d*x-c-1

==> diff(f(x),x,x)  = 12*x^2+6*x+2*c  >= 0  for  c>= 3/8.

So, f in convex in x for c>= 3/8 ==>

g(c,d) = max(f(0), f(1)) = max(-1-c, 1+d) ,  for  c>= 3/8.

So, g(c, -c-2) = -c-1, (c>= 3/8)
and
limit(g(c, -c-2), c=infinity) = -infinity

==> g is not bounded below.

Edit. g(c,d) here represents max f(x) for x in [0,1] instead of [-1,1] as was asked.
For the [-1,1] version see the comment below.

## All you need is...

kekuncirahsia:=proc(n::posint) local r:=irem(n,9); `if`(r=0,9,r) end;

add8 := (x,y) -> convert( convert(x,decimal,octal) + convert(y,decimal,octal),  octal,decimal );

(The addition must be done in base 10).

Note that lists are added componentwise.

## proc...

Here is a general but not very efficient procedure.
Of course it would be much better to solve the equation only once, but in this case, the solutions must be verified and the special cases must be considered.

inteq:=proc(f,x,vpar)
local vab,ab,s,T,r,n:=0;
indets(f,name) minus {x}; vab:=[op(%)];
T:=combinat[cartprod]([ [seq(vpar)] \$ nops(vab) ]);
while not T[finished] do
ab:=T[nextvalue]();
s:=solve(eval(f, vab=~ab),x);
if s=x then print(vab=ab,"identity!") fi;
s:=select(type,[s],integer);
if s<>[] then n:=n+1; r[n]:=[ab,s];DocumentTools[Tabulate]([n]) fi;
#if s<>[] then n:=n+1; print(n,[vab=ab,x=s]) fi
od;
n,vab,x,eval(r);
end:

inteq(a*x + b = sqrt(c*x + d),x,-2..2);

[a, b, c, d] = [0, 0, 0, 0], "identity!"
[a, b, c, d] = [0, 1, 0, 1], "identity!"

176, [a, b, c, d], x,

## spirals...

Factorizing f7 ==>

p1-t1  or  p2-t2  or  p3-t3  is an integer multiple of Pi.

For p1-t1 = 0 (or Pi), from f1 and f2 ==> two spirals, namely

plots[spacecurve]([2.350000000*cos(t1), 2.350000000*sin(t1), t1], t1=-Pi..Pi);
plots[spacecurve]([-.350000000*cos(t1), -.350000000*sin(t1), t1], t1=-Pi..Pi);

For p2-t2 = 0 (or Pi) you get two spirals in (x,y,t2) etc.  If you want here (x,y,t1), t2 must be expressed wrt t1.

Note that the (x,y) projection is contained in 6 circles.

 First 102 103 104 105 106 107 108 Last Page 104 of 114
﻿