vv

13977 Reputation

20 Badges

10 years, 36 days

MaplePrimes Activity


These are answers submitted by vv

 

restart;
with(GraphTheory):
with(SpecialGraphs):
K4 := CompleteGraph(4):
IsPlanar(K4, 'F'):   # true

G:=K4:
n:=max(Vertices(G)):
V1:=[Vertices(G)[],n+1]:
E1:=Edges(G) union {seq({i,n+1},i=1..n)}:
G1:=Graph(V1,E1):
IsPlanar(G1, 'F1'); # iff G is Outerplanar

        false

I had a similar problem with SMTLIB:-Satisfy in Maple 2018 (on Windows 7).

Installing the Visual C++ Redistributable for Visual Studio 2012 Update 4

https://www.microsoft.com/en-us/download/details.aspx?id=30679#

solved the problem.

 

Maple does not miss solutions here. But solve uses the (documented) convention that the arguments of abs are assumed to be real.

Note that the equation has infinitely many complex solutions; they can be found in terms of RootOfs (or even explicitely, but with huge expressions).

However, in this case Maple assumes that the unknown itself is real, not only the argument of abs. (There are 4 complex solutions having the argument of abs equal to -1).

It's the Java GUI. It happens sometimes. I miss the Classic interface. Java could be nice for developers, but for users ... slow and buggy.

The Cayley matrix must have numeric entries (1..n)

 

ct := <<e | p | q | r | s | t | u | v | w | x | y | z>, <p | q | e | y | u | w | z | r | x | t | v | s>, <q | e | p | v | z | x | s | y | t | w | r | u>, <r | z | t | s | e | y | v | x | p | u | q | w>, <s | w | y | e | r | q | x | u | z | v | t | p>, <t | r | z | x | w | u | e | q | y | p | s | v>, <u | x | v | p | y | e | t | z | s | r | w | q>, <v | u | x | z | q | r | y | w | e | s | p | t>, <w | y | s | t | x | z | p | e | v | q | u | r>, <x | v | u | w | t | s | q | p | r | e | z | y>, <y | s | w | u | p | v | r | t | q | z | e | x>, <z | t | r | q | v | p | w | s | u | y | x | e>>:

with(GroupTheory):

L:=[seq(ct[1])];

[e, p, q, r, s, t, u, v, w, x, y, z]

(1)

CT:=eval( ct, L=~[ seq(1..nops(L)) ] ):

G:=CayleyTableGroup(CT, labels=L, check=true);

_m637567552

(2)

# DrawCayleyTable(G);

IdentifySmallGroup(G);

12, 3

(3)

AreIsomorphic(G, Alt(4));

true

(4)

So, your group is (isomorphic to) the alternating group "(A)[4]" on "4 elements."

 

Here is a general solution.
Probably it cannot be accepted as a homework solution, but it's a good exercise for you to understand how it works (Maple+maths).

n:=4: # take n:=5 for your problem
f := ( 1 + a * mul(x-k, k=1..n) )/x:
f := unapply(simplify(eval(f,solve(eval(numer(f),x=0),{a}))), x):
seq( 'f'(k)=f(k), k=-1..7 );

       f(-1) = 4, f(0) = 25/12, f(1) = 1, f(2) = 1/2, f(3) = 1/3, f(4) = 1/4, f(5) = 0, f(6) = -2/3, f(7) = -2

 

For n = 34, R[n] alone is a rational number whose denominator has about 5*10^9 digits!

Are you sure you really want this?

You can use the explicit option in solve and avoid allvalues.

F := [x^2+y+z-1, y^2+x+z-1, z^2+x+y-1]:
Sol:=solve(F, explicit);

    Sol := {x = 0, y = 0, z = 1}, {x = 0, y = 1, z = 0}, {x = 1, y = 0, z = 0}, {x = 2^(1/2)-1, y = 2^(1/2)-1, z = 2^(1/2)-1}, {x = -1-2^(1/2), y = -1-2^(1/2), z = -1-2^(1/2)}
seq(simplify(eval(F,s)), s=Sol);
     [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]
# or ...
seq(simplify(subs(s,F)), s=Sol);
    [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]

 

If we insist on using LSystem, a more natural solution is:

restart;
with(Fractals:-LSystem): with(plots):
state:= "F-F-F":
cons:= proc(n)
  local x:=sprintf("%.10f",((1/3.)^n));
  [ "F"="draw:"||x, "+"="turn:-60", "-"="turn:-240" ]
end:
rules:= ["F"="F+F-F+F"]:
display(seq(LSystemPlot(Iterate(state, rules, n), cons(n))$4, n=0..6), insequence);

One obtains the same animation as in my first direct solution.

nextkoch:=(a,b)->
((2*a+b)/3, (2*a+b)/3+ (b-a)/3*evalf(exp(-Pi/3*I)), (a+2*b)/3):
L:=evalf([0,1,1/2+I*sqrt(3)/2,0]): N:=6: LL[0]:=L:
for j to N do
  L:=[ seq( [ L[i], nextkoch(L[i],L[i+1]) ][], i=1..nops(L)-1), L[-1] ]:
  LL[j]:=L;
od:
plots:-animate( plots:-complexplot, [LL[floor(n)]], n=0..N+.99, 
  scaling=constrained, axes=none, frames=4*(N+1), paraminfo=false);

The shape of a quadrilateral inscribed in the unit circle and having an inscribed circle.

f := (a,b) -> 1/2*(b+arccos(sin(2*a-b)/tan(b))):
dis:=(A,B)-> sqrt(inner(A-B,A-B)):
bisA:=proc(A,B,C)
  local b,c,M;
  b,c:=dis(A,C),dis(A,B);
  M:=(b*B+c*C)/(b+c);
  x*(A[2]-M[2])+y*(M[1]-A[1]) + A[1]*M[2]-A[2]*M[1]
end:
P:=proc(a0,b0)
  local a:=evalf(a0), b:=evalf(b0), c:=f(a,b), p1,p2,p3,p4, r, II;
  if a0>b0-0.001 then return plot() fi;
  p1,p2,p3,p4:=[1,0],[cos(4*a),sin(4*a)],[cos(4*b),sin(4*b)],[cos(4*c),sin(4*c)];
  II:= eval([x,y], solve( [bisA(p2,p1,p3), bisA(p3,p2,p4)]) );
  r:=evalf(eval(dis(II,p2)*cos(b))); 
  plots:-display(plot([p1,p2,p3,p4,p1]), plottools:-circle(II,r, color=blue), plottools:-circle([0,0],1));
end:
Explore(P(a,b), parameters=[a=0.01..Pi/2-0.02, b=0.02..Pi/2-0.01], initialvalues=[a=Pi/8,b=Pi/4]);

###    0 < a < b < Pi/2

sys := { D[1](F)(x(t),y(t))*diff(x(t), t) + D[2](F)(x(t),y(t))*diff(y(t), t) = 0};

{(D[1](F))(x(t), y(t))*(diff(x(t), t))+(D[2](F))(x(t), y(t))*(diff(y(t), t)) = 0}

(1)

dsolve(sys, {y(t)});

[{y(t) = RootOf(F(x(t), _Z)+_C1)}]

(2)

So, x() is arbitrary. Should be obvious [provided that dF/dy <> 0 near the solution], the general solution being F(x(t), y(t)) = const

 

dsolve(sys, {x(t), y(t)}) # similar

 

 

 

restart;
PP:=proc(n::posint, kmin::posint, L::list(prime), nSolMax::posint)
# Prime partitions with elements >= kmin, starting with L
local Sol:=table(), nSol:=0, E;

E:=proc(L)
local p,sL:=add(L);
if L<>[] then p:=L[-1] else p:=nextprime(kmin-1) fi;
while p+sL<=n and nSol<=nSolMax do
  if p+sL=n and nSol<nSolMax then Sol[++nSol]:=[L[],p] fi;
  if nSol>=nSolMax then return fi;  
  E([L[],p]);
  p:=nextprime(p);
od;
end:

if L<>[] and add(L)=n then  Sol[++nSol]:=L fi;   
E(L);
entries(Sol,nolist);
end:

SingPrime:=proc(p::prime,n::posint)  
# there exist only 1 PP starting with p
evalb(nops([PP(n,p,[p],2)])=1)
end:

Q := proc(n)    # list of SingPrime's
local p, P:=select(isprime, [seq(1..n)]);
select(SingPrime, P, n)
end:

SingPrime(3,8), SingPrime(5,8);
                          true, false
for n from 2 to 500 do
    if Q(n)=[] then printf("%d ",n) fi
od;

63 161 195 235 253 425

(The procedures are not optimized.)

An implementation of Lehmer's algorithm.

Lpi := proc(x)  # Lehmer pi
  local phi, Lpi1, M:=10^7 ;
    
  phi := proc(x, a)
  local t;
  if a <= 1 then  return iquo(x + 1, 2) fi;
  t := thisproc(x, a-1) - thisproc(iquo(x, ithprime(a)), a-1);
  procname(x, a) := t;
  t;
  end;

  Lpi1 := proc(x)
  local a,b,c,s,w,i,j,L, xx:=trunc(x);
  if (trunc(x) < M) then return NumberTheory:-pi(x) fi;
  a := thisproc(iroot(xx, 4));;
  b := thisproc(isqrt(xx));
  c := thisproc(iroot(xx, 3));
  s := phi(xx,a) + (b+a-2) * (b-a+1) / 2;
  for i from a+1 to b do
    w := iquo(xx , ithprime(i));
    L := thisproc(isqrt(w));
    s := s - thisproc(w);
    if (i <= c) then
      for j from i to L do
        s := s - thisproc(iquo(w , ithprime(j))) + j - 1
      od
    fi
  od;
  s
  end;

Lpi1(x)
end:

CodeTools:-Usage(Lpi(6469693230));
memory used=6.11GiB, alloc change=80.00MiB, cpu time=55.19s, real time=50.11s, gc time=10.83s
                           300369796


 

eq := Z(x) =  3/2-9/2*exp(-2*x)-9/2*exp(-x)+1/2*int(exp(-y)*Z(x-y), y= 0..ln(2));

Z(x) = 3/2-(9/2)*exp(-2*x)-(9/2)*exp(-x)+(1/2)*(int(exp(-y)*Z(x-y), y = 0 .. ln(2)))

(1)

ZZ:=x -> A*exp(-2*x)+B*exp(-x)+C

proc (x) options operator, arrow; A*exp(-2*x)+B*exp(-x)+C end proc

(2)

expand(eval( (lhs-rhs)(eq), Z=ZZ));

(1/2)*A/(exp(x))^2+B/exp(x)+(3/4)*C-3/2+(9/2)/(exp(x))^2+(9/2)/exp(x)-(1/2)*B*ln(2)/exp(x)

(3)

coeffs(%, [exp(x),exp(2*x)]);

(3/4)*C-3/2, (1/2)*A+9/2, B+9/2-(1/2)*B*ln(2)

(4)

ABC:=solve([%],{A,B,C});

{A = -9, B = 9/(ln(2)-2), C = 2}

(5)

Zsol:=eval(ZZ(x),ABC);

-9*exp(-2*x)+9*exp(-x)/(ln(2)-2)+2

(6)

simplify(eval( (lhs-rhs)(eq), Z=unapply(Zsol,x))); # Check

0

(7)

#################################################

 

A strange fact is that intsolve finds a wrong solution but very close to it.

 

eq := Z(x) =  3/2-9/2*exp(-2*x)-9/2*exp(-x)+1/2*int(exp(-y)*Z(x-y), y= 0..ln(2));

Z(x) = 3/2-(9/2)*exp(-2*x)-(9/2)*exp(-x)+(1/2)*(int(exp(-y)*Z(x-y), y = 0 .. ln(2)))

(8)

intsolve(eq, Z(x)); # ?

Error, (in intsolve) integral equation is not linear.

 

EQ:=IntegrationTools:-Change(eq, x-y=t, t);

Z(x) = 3/2-(9/2)*exp(-2*x)-(9/2)*exp(-x)+(1/2)*(int(exp(t-x)*Z(t), t = x-ln(2) .. x))

(9)

intsolve(EQ, Z(x));

Z(x) = 3/2-(9/2)*exp(-2*x)-(9/2)*exp(-x)+(3/4)*(6*ln(2)*exp(x)-exp(2*x)+6)*exp(-x)/((ln(2)-2)*exp(x))

(10)

WrongSol:=rhs(%);

3/2-(9/2)*exp(-2*x)-(9/2)*exp(-x)+(3/4)*(6*ln(2)*exp(x)-exp(2*x)+6)*exp(-x)/((ln(2)-2)*exp(x))

(11)

plot([Zsol,WrongSol], x=0..5);

 

evalf( eval(Zsol - WrongSol,  x=1/10) );

-.938979396

(12)

evalf( eval(Zsol - WrongSol,  x=2) );

-0.932503746e-1

(13)

 


 

Download IntEq-vv.mw

First 43 44 45 46 47 48 49 Last Page 45 of 120