vv

13922 Reputation

20 Badges

10 years, 8 days

MaplePrimes Activity


These are replies submitted by vv

@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 

This is not possible without examples with known eigenvalues, because the accuracy of the command (working with hardware floats) is not documented for such large matrices. But you refuse to provide them.

@mehdibaghaee 

The workaround above seems to work now in all situations (i.e. including the correct isomorphism if requested).


@dharr 

@tomleslie 

An ad-hoc workaround:

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:

Edit:  seems to work in all situations and returns the correct isomorphism.

@mehdibaghaee 

OK, I wish you good luck.

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