vv

14027 Reputation

20 Badges

10 years, 43 days

MaplePrimes Activity


These are replies submitted by vv

((t->[1,t[]])~)~(Tours);

@Kitonum 

@tomleslie 

In this context almost nothing can be guaranteed by a CAS: a zero of a continuous function, the convergence of a numerical sequence, ...
is(exp(1)+Pi, rational);
returns false, but this is not known. etc.

@acer 

You are right, I forgot (or maybe did not know) that for one variable method=branchandbound is able to find global extrema.

@dellair 

So, are you saying that Maple crashes is you copy&paste the above code in a fresh session?
In Maple 2016.2, 64 bit, Win 7 it works.

ok.mw

@dellair 

Note that Maximize also finds (generally) only local maxima. In your example the function was (almost) concave, that is why the command worked. Try:

Optimization:-Maximize(sin(x)*sin(x^2),x=1..7);

 

@Markiyan Hirnyk 

Your a  should be
a := int(eval(f,x=t)*exp(t), t = 0 .. x);

instead of

a := int(f*exp(t), t = 0 .. x);
Idem for b.
And Maple cannot compute them.

In Maple 2016.2 (64 bit) I obtain the correct result (for any value of UseHardwareFloats).

OK, but I don't see any collecting rule here. From a Maple point of view this would make sense if you want e.g. to extract some subexpression. But this subexpression must be somehow defined.

@taro 

@tomasmedici 

Yes, Carl found a counterexample for 4x4.
You have 2 options.
1. Use

IsI := proc(G1::GRAPHLN, G2::GRAPHLN, phi::name)
try  GraphTheory:-IsIsomorphic(args); 
  catch: false;  # actually FAIL
end try;
end proc:

It is OK for 4x4 (I have have checked it for graphs without loops).

2. Use the "from scratch" version. It works in all situations but is slower.
Note that for 5x5 there are too many graphs:  > 10^6 without loops and > 3*10^7 including loops, so you cannot list them.

@Carl Love 

Yes, for the proper digraphs (no loops) with 4 vertices I counted 110 counterexamples. It seems that for all of the pairs the graphs are not isomorphic. So, a better workaround for the moment would be:

IsI := proc(G1::GRAPHLN, G2::GRAPHLN, phi::name)
try  GraphTheory:-IsIsomorphic(args); 
  catch: FAIL;
end try;
end proc:

where FAIL should (probably) be interpreted as false.
 

@tomleslie 

1. The "extraneous crap" inverts the isomorphism G2-->G1. This would be necessary when IsIsomorphic(G1,G2,f) gives an error but  G1 and G2 are still isomorphic and f is wanted.
2. I said: seems to work. Anyway it works for the original question.
3. Do you have an example of a workaround for a Maple command which is guaranteed to work in each and every situation? I'd say that IsIso it's a typical workaround; do you have a counterexample for it?


 

 

@tomleslie 

It seems that my workaround is invisible :-)

IsIso(G1,G2);
      false

 

@mehdibaghaee 

It is not easy to construct good examples. This one is not good enough. How do you know that your eigenvalues are correct? (Keep in mind that the determinant is very complicated to compute and would need exact entries which you don't have).
An ideal example would have rational (or even integer) entries and all the eigenvalues be known (not necessarily rational, but relatively simple).
Maple is able to compute Eigenvalues(K,M)  but I simply don't know how far are these eigenvalues from the exact ones for such huge matrices. So, good examples are mandatory.

Note that for standard eigenvalues Maple works very well and probably it is fine for generalized ones too; for your example they are not close but I suspect that your eigenvalues are not correct.

restart;
with(LinearAlgebra):
n:=700:
L:=[seq(3.333*k,k=1..n)]:
A:=DiagonalMatrix(L,datatype=float[8]):
Q:=RandomMatrix(n,n, generator=rand(-1. .. 1.)):
Q1:=Q^(-1):
B:=Q1.A.Q:
LL:=sort(convert(Eigenvalues(B),list)):
max(abs~(L-LL));
#                  HFloat(4.88817022414878e-8)

 

 

Have you tried the above workaround? (Just use IsIso instead of IsIsomorphic). E.g.

restart;
IsIso := proc(G1::GRAPHLN, G2::GRAPHLN, phi::name)
local r;
try  GraphTheory:-IsIsomorphic(args); 
  catch:
  if nargs=2 then GraphTheory:-IsIsomorphic(G2,G1);
  else r:=GraphTheory:-IsIsomorphic(G2,G1,phi);
       phi:=sort(map(u -> rhs(u)=lhs(u), eval(phi)));
  r;
  fi;  
end try;
end proc:
interface(rtablesize=infinity):
n:= 3: N:= n^2:
<ListTools:-Categorize(
   (M1,M2)-> IsIso(GraphTheory:-Digraph~([M1,M2], n)[]),
   map(L-> Matrix(n,n,L), combinat:-permute([0$N, 1$N], N)   )
)>; 

 

@tomasmedici 

First 118 119 120 121 122 123 124 Last Page 120 of 177