## 12530 Reputation

8 years, 214 days

## intint...

G:=proc(k::posint, n::posint)
local f,g,x,y,u,v;
f:=(1/2)*(1-cos(k*Pi*x)*cos(n*Pi*y))/(sin((1/2)*Pi*x)^2+sin((1/2)*Pi*y)^2);
g:=simplify(subs([x=2/Pi*arctan(u),y=2/Pi*arctan(v)],f)*4/(Pi^2*(u^2+1)*(v^2+1)));
expand(g);
int(int(%,u=0..infinity),v=0..infinity)
end:

t:=time():
G(9,9);
time()-t;

1.279

## mod 70...

After some "reverse engineering", it is a group but for mod 70.

Simply construct the Cayley table:

G:=[5, 15, 25, 45, 55, 65];
Matrix(6, (i,j) -> G[i]*G[j] mod 70);

Alternatively, you may use Magma (see ?Magma) but the problem is too simple to need it..

## solve...

phasor:=(r,a)->r*exp(I*a*Pi/180):   #simpler version
ec:=phasor(U__C, -90) = phasor(400, X)-phasor(150, 0)+phasor(1744/10, 90):
s:=solve(evalc([Re(ec),Im(ec)]),allsolutions);

uc:=eval(U__C,s):
[eval(uc,[_Z1=0,_B1=0]),eval(uc,[_Z1=0,_B1=1])];

evalf(%);

So, you will take the second (positive) solution.

Note that
fsolve(evalc([Re(ec),Im(ec)]), {U__C=0..1000, X=0..360});
does not provide a solution (it should!), but
fsolve(evalc([Re(ec),Im(ec)]), {U__C=200, X=270});

## Prime number theorem...

Here pi is actually numtheory[pi]; the package was loaded previously.

The function

y:=numtheory[pi](floor(x))/(x/ln(x))-1;

has indeed the graph:

Note that this function has an infinity of discontinuities and

limit(y, x=infinity) = 0.

(this is the celebrated  Prime number theorem; unfortunately Maple cannot compute the limit).

## Example...

restart;
with(plottools): with(plots):
dis3d:=proc(p1,p2)
local A,B;
A:=getdata(p1)[3];
B:=getdata(p2)[3];
min( seq(seq(seq(seq(add( (A[i,j]-B[ii,jj])^2 ), i=op(2,A)[1]),j=op(2,A)[2]),ii=op(2,B)[1]),jj=op(2,B)[2]));
sqrt(%)
end:
num:=50: np:=9:tp:=9: eps:=3:
#  increasing  np,tp  too much will slow down the program

cen:=rand(0.0..100.0):
dir:=2*rand(0..1)-1:
h:=rand(1.0..60.0):
rr:=rand(0.25..5.0):
t[0]:= tubeplot([dir()*h()*t, dir()*h()*t, dir()*h()*t], t = -1 .. 1,
for n to num do
print("n=",n);
ok:=false;
while not(ok) do
t[n]:= tubeplot([cen()+dir()*h()*t, cen()+dir()*h()*t, cen()+dir()*h()*t],
t = -1 .. 1, radius = rr(), style=surface,numpoints=np,tubepoints=tp);
for k from 0 to n-1 do
ok := dis3d(t[k],t[n]) >eps;
if not(ok) then break fi
od;
od;
od:
display( seq( t[n],n=0..num), axes=none,scaling=constrained);

Edit. dir() was not initially used; it is intended for "more random" directions of the cylinders.
dis3d(p1,p2)  computes the distance between two 3d plots.
A new cylinder is added only if the distance to the previous ones is > eps.

## numeric...

Use a procedure.

f:=unapply(Determinant(M2),omega):
fsolve(f, complex);

It seems that there is no solution.

N:=Matrix( 400,400, (i,j)-> abs(f(-10+i/20 (-10+j/20)*I)) );
min(N),max(N);

So, your function is almost constant and very close to 0. You can't hope to solve it numerically; even if you find a program providing a solution, I don't think you should trust it. You should re-think the problem i.e, try another approach to solve it if you are sure that a solution (of the problem, not of this equation) exists.

P.S. I don't understand the reason for evalf[4].

## Digits...

Use Digits:=10000     (!!!)

and it works.

What do you want to do with this? It is quasi-nonsense to have floats such as  -9.8455282400 (with 11 significant digits) and to be forced to set Digits to such a huge number).

## 2 errors remained...

You have an error in the algorithm. The corrected iterate is:

But there is also a more subtle error.

XX:=x;

must be replaced by

XX:=Vector(x);

(or XX:=LinearAlgebra[Copy](x)). Otherwise x and XX will share the same memory, creating a mess in this case.

The program will work after that.

## collect and sort...

sort(collect(%, Nu));

## E.g....

Pascal := proc (n::posint)
local x,i,k,dd;
k:=length(binomial(n,floor(n/2)));
dd:=cat("%",2*k,"d");
for i from 0 to n do
printf(cat(" "\$(n-i)*k,dd\$(i+1),"\n"), coeffs(expand((x+1)^i)));
end do end proc:
Pascal(12);

## Or......

plot( [2,3,5]*~x^2, x=-2..2);

## How to generate such functions...

h:=(n,x)->1/2+1/2*tanh(n*x):
f:=proc(a,b,c,d,n)
proc(x) c+ (d-c)*h(n,x-a)*h(n,b-x) end
end:

The following function will look the same as the first of OP's function

plot( f(-80,40,11/9,19,50), -200..200);

## strange function...

Of course it is not constant:

f:=1+18*(sinh(9*x-9)-sinh(3*x-477))^2/(9*cosh(9*x-9)+cosh(3*x-477))^2;
limit(f,x=infinity),limit(f,x=-infinity);

eval(f,x=0);evalf(%);

19.000000

To be able to plot, Digits must be increased.

Digits:=20;  # this is enough

plot(f,x=-200..200); # almost an "impulse"

## syntax...

You must use the proper syntax for Surface. E.g.

cone:= Surface(<r*cos(theta),r*sin(theta),2*a-r>,r=0..2*a, theta=0..2*Pi):

Flux( VectorField(<x, y, z>, cartesian[x, y, z]),  cone );

## DS approach...

It should be not too difficult, following the next steps.

1. Find the 11 regions (connected components) R_1,...,R_11
and fix a point P_k in each of them
(each region is determined by 2, 3 or 4 inequalities of the form lines[i]<0 or lines[i]>0)
2.  OK:={}
3. For each S subset {P_1,...,P_11} having 4 elements do
If S is admissible (i.e. in each halfspace there are exactly 2 points of S), then OK:=OK union {S}.

The set OK will contain all the desired configurations.

Here is a DirectSearch approch for finding a configuration. It is possible to find several configurations if we repeat the call.

lines := [-(1/2)*x+y, (1/2)*x+y, 1-x+(1/2)*y, 3-x-(1/2)*y]:
pl:=(i,j) -> eval(lines[i],[x=x[j],y=y[j]]):
cond1:=seq(seq(pl(i,j)^2>eps,i=1..4),j=1..4):
cond:= seq( op( [
pl(i,1)*pl(i,2)*pl(i,3)*pl(i,4)>eps,
min(pl(i,1),pl(i,2),pl(i,3),pl(i,4))<-eps,
max(pl(i,1),pl(i,2),pl(i,3),pl(i,4))>eps  ])  ,
i=1..4):
bounds:=seq(x[i]=-10..10,i=1..4), seq(y[i]=-10..10,i=1..4),  eps=0..10:
vars:=[seq(x[i],i=1..4),seq(y[i],i=1..4),eps]:
with(DirectSearch):
ds := Search(-eps, [cond, cond1,bounds], variables=vars):
pts:= [seq( [ds[2](i),ds[2](i+4)],i=1..4 )];

plot1:=plots[pointplot](pts,color=red,symbol=solidcircle,symbolsize=8):
plot2:=plots[implicitplot](lines,x=-10..10,y=-10..10):
plots[display](plot1,plot2,axes=none);

 First 107 108 109 110 111 112 Page 109 of 112
﻿