vv

13867 Reputation

20 Badges

9 years, 352 days

MaplePrimes Activity


These are answers submitted by vv

BooleanSimplify returns a sum of products [sum=%or, product=%and].
Your expression is far from having a single term i.e. a product only. It is huge.
In order to obtain something you will have to fix some variables.

 

restart;

ee:=
((((((((((((((OD &and (NPi &or NEXTotp)) &and &not ((((((((POinoBlaze &and &not (OD &and ((POLYGi1 &and POBIASPdrawing2) &or  (POLYGi1 &and POBIASMdrawing2)))) &or (OD &and (spolyp2 &or spolym2))) &and &not (OD &and ((POLYGi2 &and POBIASPdrawing4) &or (POLYGi2 &and POBIASMdrawing4)))) &or (OD &and (spolyp4 &or spolym4))) &and &not (OD &and ((POLYGi3 &and POBIASPdrawing6) &or (POLYGi3 &and POBIASMdrawing6)))) &or (OD &and (spolyp6 &or spolym6))) &and &not BLACKBOXall) &and &not POLYACTsign)) &and (((BULK &and &not (SUBS1 &and &not MSUB0)) &and &not (NWELi &and &not MKRMSKREG)) &and &not PWbki)) &and &not ((NACTALL0 &and &not  NWRNW) &and &not  PWELL1)) &and &not OD225dg) &and &not OD218dg)  &and &not ((VNPNMSIPW &and &not EMPTY) &or (VNPNMSIPW25 &and &not EMPTY))) &and &not RPOi) &and &not ((NACTALL0 &and PWELL1)  &and  POi)) &and &not (((OD &and (PPi &and &not (SEALRINGi  &and &not PMDMY))) &and &not POi) &and PWELL1)) &and &not VTHNi) &and &not VTLNi) &and ((DCOng &or DCOmsk) &or DCOdg)) &and &not MKRHPA) &and &not EMPTY:
 

vars:=[indets(ee,name)[]]:

varsx:=[seq(x||n,n=1..nops(vars))];

[x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30, x31, x32, x33, x34, x35, x36, x37, x38, x39, x40, x41, x42, x43, x44, x45, x46]

(1)

ex:=eval(ee,vars =~ varsx);

`&and`(`&and`(`&and`(`&and`(`&and`(`&and`(`&and`(`&and`(`&and`(`&and`(`&and`(`&and`(`&and`(`&and`(`&and`(x12, `&or`(x9, x8)), `&not`(`&and`(`&and`(`&or`(`&and`(`&or`(`&and`(`&or`(`&and`(x43, `&not`(`&and`(x12, `&or`(`&and`(x16, x39), `&and`(x16, x36))))), `&and`(x12, `&or`(x30, x27))), `&not`(`&and`(x12, `&or`(`&and`(x17, x40), `&and`(x17, x37))))), `&and`(x12, `&or`(x31, x28))), `&not`(`&and`(x12, `&or`(`&and`(x18, x41), `&and`(x18, x38))))), `&and`(x12, `&or`(x32, x29))), `&not`(x33)), `&not`(x42)))), `&and`(`&and`(`&and`(x1, `&not`(`&and`(x24, `&not`(x7)))), `&not`(`&and`(x10, `&not`(x34)))), `&not`(x22))), `&not`(`&and`(`&and`(x35, `&not`(x11)), `&not`(x21)))), `&not`(x14)), `&not`(x13)), `&not`(`&or`(`&and`(x45, `&not`(x5)), `&and`(x46, `&not`(x5))))), `&not`(x23)), `&not`(`&and`(`&and`(x35, x21), x19))), `&not`(`&and`(`&and`(`&and`(x12, `&and`(x20, `&not`(`&and`(x44, `&not`(x15))))), `&not`(x19)), x21))), `&not`(x25)), `&not`(x26)), `&or`(`&or`(x4, x3), x2)), `&not`(x6)), `&not`(x5))

(2)

with(Logic):

#BooleanSimplify(ex);

tf:=[true,false]:

r:=rand(1..2):

fex:=unapply(ex,varsx):

for k to 100000 do   # find an x for which ex=true
xxx:=[seq( tf[r()], i=1..46)]:
fex(xxx[]);
simp:=BooleanSimplify(%):
if(BooleanSimplify(%)) then print([k]); break fi;
od:
xxx;
simp;

[4648]

 

[true, false, true, true, false, false, true, true, false, false, true, true, false, false, false, false, true, true, false, true, false, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, false, true, false, false, true, true, true, false, false, false]

 

true

(3)

xx:=xxx:  # fix some xj  to be able to simplify
for j from 5 to 25 do xx[j]:=x||j od:
fex(xx[]):
simp:=BooleanSimplify(%);
'x'=xx;

Logic:-`&or`(Logic:-`&and`(x12, x19, x7, x8, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)), Logic:-`&and`(x12, x19, x7, x9, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)), Logic:-`&and`(x12, x19, x8, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x24), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)), Logic:-`&and`(x12, x19, x9, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x24), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)), Logic:-`&and`(x12, x7, x8, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x20), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)), Logic:-`&and`(x12, x7, x8, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x21), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)), Logic:-`&and`(x12, x7, x9, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x20), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)), Logic:-`&and`(x12, x7, x9, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x21), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)), Logic:-`&and`(x12, x8, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x20), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x24), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)), Logic:-`&and`(x12, x8, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x21), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x24), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)), Logic:-`&and`(x12, x9, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x20), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x24), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)), Logic:-`&and`(x12, x9, Logic:-`&not`(x10), Logic:-`&not`(x13), Logic:-`&not`(x14), Logic:-`&not`(x21), Logic:-`&not`(x22), Logic:-`&not`(x23), Logic:-`&not`(x24), Logic:-`&not`(x25), Logic:-`&not`(x5), Logic:-`&not`(x6)))

 

x = [true, false, true, true, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, false, false, true, true, true, true, false, false, false, false, false, false, true, false, false, true, true, true, false, false, false]

(4)

 


 

Download boolean.mw

 


 

f(s) = min { (s*t)^((s*t)^(s*t))/t^(t^t):  t > 0 }

restart;

g :=(s,t)-> t^(s*t)*(ln(s)+ln(t))*s^(s*t)-t^t*ln(t):

dg:=unapply(simplify(diff(g(s,t),t)),[s,t]):

lnf:=proc(s)
local tmin:=fsolve(dg(s,t),t=0.5);
evalf(g(s,tmin))
end:

plot(lnf, 1..6, title="ln(f)");

 

plot(exp@lnf, 1..6, title="f");

 

 

z := proc (x) options operator, arrow; tan(alpha)*x-(1/2)*g*x^2/(u^2*cos(alpha)^2) end proc

proc (x) options operator, arrow; tan(alpha)*x-(1/2)*g*x^2/(u^2*cos(alpha)^2) end proc

(1)

cond:=z(a)=h:

u2:=rhs(isolate(cond,u^2));

-(1/2)*g*a^2/((h-tan(alpha)*a)*cos(alpha)^2)

(2)

#u2>0, --> min

u2t:=subs([tan(alpha)=t, cos(alpha)=sqrt(1/(1+t^2))], u2):

simplify(diff(u2t,t));

(1/2)*g*a^2*(a*t^2-2*h*t-a)/(a*t-h)^2

(3)

tmin:=select(s -> is(s>0),[solve(%,t)])[] assuming positive

(h+(a^2+h^2)^(1/2))/a

(4)

u__min:=radnormal(sqrt(eval(u2t,t=tmin)));

(g*(h+(a^2+h^2)^(1/2)))^(1/2)

(5)

alpha__u__min:=arctan(tmin);

arctan((h+(a^2+h^2)^(1/2))/a)

(6)

 


Download projectile.mw

After studying Maple such things will be possible. E.g.

funny := module() option package;  export `<`;
   `<`:= proc(a::list(realcons), b::realcons) option overload;
              select(t -> t<b, a);
         end proc;
end module:

with(funny):
a:=[1,2,3,4,5]:
b:=a<4;

                         b := [1, 2, 3]

 

Suppose you want F[i, j,...](x, y,...)  to return  x^i + y^j + ...

F:=proc()
  local ind:=op(procname); 
  add( [args] ^~ [ind] )
end:

F[i,j,99](x,y,z);
   
x^i+y^j+z^99

Of course some parameter checks in the procedure are recommended.

b:=A[..,6]:
C:=A[..,[1..5,7..11]]:
(C^(-1).b)[6];

 

(simplify@expand@convert)( abs(u+v)^2+abs(u-v)^2, conjugate );

       

1.   As documented.

2. Because is tries to be smart.
Also:
is(0.5 = 1/2);
     true

3. Because is is not perfect.
Also:
is(exp(1)+Pi, rational);
    false
Should be FAIL, the result is not known (yet)!

 

f:=exp(t^(1/3)-2*t^(7/4)):
s:=series(f,t,6);

 

 

sort(s,t,ascending);


 

 

 

restart;

s:=Sum(binomial(i+k,k),i=0..infinity);

Sum(binomial(i+k, k), i = 0 .. infinity)

(1)

eval(s,k=7); value(%);

Sum(binomial(i+7, 7), i = 0 .. infinity)

 

infinity

(2)

value(s);

0

(3)

value(s) assuming k>0;

infinity

(4)

sum(binomial(i+k,k),i=0..infinity, parametric);

piecewise(k <= -2, 0, -1 <= k, Sum(binomial(i+k, k), i = 0 .. infinity))

(5)

So, the sum for an arbitrary k was 0 because this is true for k <= -2, a "generic" result!

 

BTW, in mathematics there exist several generalized summation methods.
For example the Poisson summation:

Sum(a[n],n=0..infinity) = Limit(Sum(a[n]*x^n,n=0..infinity),x=1,left);

Sum(a[n], n = 0 .. infinity) = Limit(Sum(a[n]*x^n, n = 0 .. infinity), x = 1, left)

(6)

In our case:

sum(binomial(i+k,k)*x^i,i=0..infinity) assuming x<1,x>0;

1/(1-x)^(k+1)

(7)

agrees with (5) for  k<-1  because

limit(%, x=1, left) assuming k<-1;

0

(8)

 

Now, for

sum(n, n=0..infinity, formal);

-1/12

(9)

 

is as you said, but in this case it was not the Poisson summation used (which gives infinity).

Here the sum was seen as Zeta(-1)

 

Zeta(-1);

-1/12

(10)

# Recall that

 Zeta(z) = Sum(1/n^z, n=1..infinity) assuming Re(z)>1;

Zeta(z) = Sum(1/n^z, n = 1 .. infinity)

(11)

[  the value -1/12 is obtained by the unique holomorphic extension for this function to C \ {1} ]

The timing seems to be similar.

t:=time[real]():
L:=combinat:-permute([1,1,1,1,0,0]):
C:=Iterator:-CartesianProduct([seq(1..15)]$6):
n:=0:
T:=table():
for c in C do
if add(L[c[i]][1],i=1..6)<>4 or
   add(L[c[i]][2],i=1..6)<>4 or
   add(L[c[i]][3],i=1..6)<>4 or
   add(L[c[i]][4],i=1..6)<>4 or
   add(L[c[i]][5],i=1..6)<>4 or
   add(L[c[i]][6],i=1..6)<>4 then next fi;
n:=n+1;
T[n]:=Matrix([seq(L[c[i]],i=1..6)]);
od:
'num'=n, 'time'=time[real]()-t;

        num = 67950, time = 65.329

Edit. We gain about 2 seconds if one of the 6 tests inside if is removed.

@shimaa sadk 

The inner sum can be computed symbolically. Do it.
Fot the outer one use evalf(Sum(...,T=0..infinity);

Unfortunately evalf for GAMMA and also Zeta is VERY slow for large arguments. E.g.

evalf( GAMMA(1+10^20*I));

The evalf operations are known to be hard/impossible to interrupt.

It seems that for infinite complex limits Maple applies some nonvalid transforms (fractional powers).

K:=Int(1/(s^2+1), s = 1-I*infinity .. 1+I*infinity):
eval(K, infinity=1000):
evalf(%);

    -9.*10^(-13)+0.1999998661e-2*I

Transforming by hand the complex limits also works (IntegrationTools:-Change  fails):

J:=Int(  1/((1+I*t)^2+1)*I, t=-infinity..infinity):
evalf(%);

    1.110223025*10^(-16)*I

 

[1.] p1 is not function (in mathematical sense, i.e. a procedure in Maple). It is an expression.

[2.] diff works, but not as you expect. You should be aware that p1 could be nowhere differentiable; this depends of a(t).
For example if a(t) = 1 for a rational t and 0 otherwise then you cannot differentiate p1.

[3.] p1(1) is a nonsense, see [1.].  Think e.g. at the meaning of  sin(t)(1).

[4.] The simplification is indeed strange, the first vector has disappeared.

[5.] See again [1.]

First 83 84 85 86 87 88 89 Last Page 85 of 120