Find the min swaps for order one powerset for a List
The question it is write one powerset function and one sort function
tha minimize the swaps for doing one order with this compare function
on powerset of the List A
cmp(a,b) -- a and b are subset of the list A
if sizeof a > sizeof b then (swap a and b; return)
if sizeof a < sizeof b than return
for i in 1..(sizeof a) repeat
for j in 1..(sizeof A) repeat
if a[i]==A[j] then return
if b[i]==A[j] then (swap a and b; return)
the result of this compare function on the sets wuold be the follow:
(15) -> powSet([1,2,3])
(15) [[],[1],[2],[3],[1,2],[1,3],[2,3],[1,2,3]]
Type: List List Any
(16) -> powSet([3,2,1])
(16) [[],[3],[2],[1],[3,2],[3,1],[2,1],[3,2,1]]
Type: List List Any
note that order depend not from the number element,
but on the position on the start List A=[1,2,3]
(17) -> powSet([1,2,3,4,5,6])
(17)
[[], [1], [2], [3], [4], [5], [6], [1,2], [1,3], [1,4], [1,5], [1,6], [2,3],
[2,4], [2,5], [2,6], [3,4], [3,5], [3,6], [4,5], [4,6], [5,6], [1,2,3],
[1,2,4], [1,2,5], [1,2,6], [1,3,4], [1,3,5], [1,3,6], [1,4,5], [1,4,6],
[1,5,6], [2,3,4], [2,3,5], [2,3,6], [2,4,5], [2,4,6], [2,5,6], [3,4,5],
[3,4,6], [3,5,6], [4,5,6], [1,2,3,4], [1,2,3,5], [1,2,3,6], [1,2,4,5],
[1,2,4,6], [1,2,5,6], [1,3,4,5], [1,3,4,6], [1,3,5,6], [1,4,5,6],
[2,3,4,5], [2,3,4,6], [2,3,5,6], [2,4,5,6], [3,4,5,6], [1,2,3,4,5],
[1,2,3,4,6], [1,2,3,5,6], [1,2,4,5,6], [1,3,4,5,6], [2,3,4,5,6],
[1,2,3,4,5,6]]
Type: List List Any
Win the one that minimize the swaps for order the powerset of the follow list
[1],[1,2],[1,2,3],[1,2,3,4],[1,2,3,4,5],[1,2,3,4,5,6]
Patterns match for composed expression
If we have one math expression B(x)
[that mean in B appear x]
[math expression is one expression where appear only symbols for function and operator of mathematics that are ok for type and compose ]
Find the max lengt subexpression g(x)
of B contain x such that
B(x)=f(g(x))
And f(y) and g(x) are both math expression.
Find Max for a function in one interval
R is the set of real numbers.
Is given a function f:A->R from set A (⊆ R) to the R, continue and derivable in one close interval
[a, b]⊆A
Write the shortest program for find
max{f(x): x in [a,b]}
knowing the function f(x) derivable in the interval [a,b]. The solution has to be correct at last until the V digit after the float point, and for all functions f that has 10 value max in which f'(x)= 0 in [a, b]. codegolf tag
On Riemann Zeta function domain
If Zeta:C->C
is the Riemann Zeta function, we give the set:
W={b: 0<b<100 and Re(Zeta(0.5+i*b))=-Im(Zeta(0.5+i*b))}
Where Re()
return the real part of its argument, and Im()
return the imaginary part of its argument.
It is requested to calculate one approximation of each element of W
; this means here all b in float numbers with b in 0..100
such way
abs(Re(Zeta(0.5+i*b))+Im(Zeta(0.5+i*b)))<0.0001
at last, to put all together in a array or list or set of float.
One can note that the below set of zeros for the Riemann function is a subset of above W
set.
{b: 0<b<100 and Zeta(0.5+i*b)=0}
Some test
Some numbers b approssimation to solution of equation
Re(Zeta(0.5+i*x))+Im(Zeta(0.5+i*x))=0
the ones that are approssimation to solution of equation Zeta(0.5+i*x)=0
too
[14.134725, 21.022039, 30.424876, 32.935061, 37.58617815, 40.918719, 43.327073, 48.00515, 49.773832]
the ones not approssimation to solution of equation Zeta(0.5+i*x)=0
too
[12.458493623791109003, 24.351346882420215577, 28.716611773969890307]
The code more short in bytes that find all these approssimations of element of the set W
wins...
Code golf tag
[tag:code-golf]
\$\endgroup\$ – DJMcMayhem♦ Aug 29 at 15:19