## dharr

Dr. David Harrington

## 4439 Reputation

18 years, 276 days
University of Victoria
Professor or university staff

## Social Networks and Content at Maplesoft.com

I am a professor of chemistry at the University of Victoria, BC, Canada, where my research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

## unclear...

It would really help if you gave a very specific example of what you want to start with and what the output would be.

## for k from k...

@Carl Love "for k from k" - very efficient; I like it. But "is" seems redundant here.

## de2diffop...

Not sure entirely about your purpose, but from your title you may want to look at de2diffop.

@Carl Love Thanks. Edge {3,6} is missing on the 2 ohm one - still planar after adding it, 2 ohms between vertices 1 and 15.

## method?...

@Tokoro No-one solved your first one-ohm problem. As I said before, it seems hard to search for these solutions, so if you have a method, you should share it.

## nice solution...

@Tokoro The is a nice answer, and quite unexpected. Across which vertices is the equivalent resistance equal to one? Please post your code creating the graph so we can play with it. All vertex degrees are three except two...

I think that the rules should have: "all currents are different and none of them are zero", otherwise my second answer (and adding a pendent edge to your answer) is stlll valid.

I didn't want to do much work here since it wasn't really clear to me that it wasn't a trick question. But after seeing it I wondered how easy it would be to search for a solution by generating connected graphs with iteratively more vertices, with all combinations of edges to the previous vertices (this generates duplicates and might not be the most efficient). However, after 8 vertices it seemed like it would never get to 9. So the real question is - did you find this with Maple?

## strict inequality case...

@evanhowington Hmm - very interesting, I thought the strict inequality case might be clearer. At least in Maple 15:

```is(1+I < 2+I);
FAIL```

This is what I would expect:  "<" not defined for complex. Now

```is(1+I < 1+I);
false```

I would still expect FAIL here - if you can't define it, then you can't answer the question. But it seems that Maple decides that if they are equal, then a decision can be made. Then the same for the symbolic case:

```is(x<x) assuming x::complex
false```

## let Maple do it...

@Earl You're welcome. I think plotting is always useful. But also, as @tomleslie pointed out, letting Maple do the definite integral gives immediately the correct answer - Maple is smart about understanding discontinuities and dealing with them. You can also use value() if you have an unevaluated integral (gray integral sign). For example:.

```int1 := ArcLength(Ellipse, theta = 0 .. 2*Pi, output = integral);
value(int1);```

@gtbastos Here are some thoughts.

There are some rejection tests you can do, for example if N is a power of M then they will commute, so if they don't commute there is no solution. Probably inspecting the eigenvalues is the best way, but if they aren't in the field then there is extra work as @Carl Love pointed out - he has a nice post about that here: https://www.mapleprimes.com/questions/203977-How-To-Find-Roots-Of-Polynomial-In-Finite#answer215097

You can do it more easily if both M and N happen to have only one root in the field -  then you can inspect all 5^9 powers of the eigenvalue of M to see which matches with the eigenvalue of N. If you can't factor at all, you can do the same thing with determinants - see attached - this takes only 15 seconds on my laptop. For determinants you may have to test more or revert to the full eigenvalue method. Is the maximum order of a matrix in the product group 5^9-1?

Both these methods can give false positives, so you then could test if the power you found actually works. A power of n or higher, where n is the matrix size, can be expressed as a linear combination of n-1 and lower powers, so that can be an efficient test (circumventing the discrete log problem to some extent). To test M^i, note the polynomial p_i(x) =q(x)p_M(x)+r(x), where p_i(x)=x^i, p_M(x) is the characteristic polynomial of M and q(x) and r(x) are the quotient and remainder when dividing x^i by p_M(x). If you take x=M in this polynomial, then p_M(M)=0 by Cayley-Hamilton, and M^i = r(M), so evaluate r(M) and see if it is N.

 > restart;
 > with(LinearAlgebra:-Generic):

Shorthand for matrix multiplication in field G

 > `&*`:= (A::Matrix,B::Matrix)->LinearAlgebra:-Generic:-MatrixMatrixMultiply[G](A,B):

Set up field. Extension ex is polynomial of degree n that is irreducible mod p. GF will randomly choose one if not supplied, but supplying one makes t global and a little easier to work with.

 > p:=5;n:=9;q:=p^n; ex:=Nextprime(t^n,t) mod p; G:=GF(p,n,ex);

Matrix may be entered in integer form and then converted to internal form

 > iM:=Matrix(3,3,[[98548,360142,206555],[841913,414734,1740986],[155301,596971,414440]]); M:=G:-input~(iM);

Try N = M^9

 > N:=M &* M: #M^2 N:=N &* N: #M^4 N:=N &* N: #M^8 N:=N &* M; #M^9

If they are powers then they should commute

 > EqualEntries(N &* M, M &* N);

Generate the determinants

 > dM:=Determinant[G](M); dN:=Determinant[G](N);

Check all q-1 powers of the determinant of M to see if they match the determinant of N

 > st:=time(): prod:=dM: for i to q-1 do;   if G:-`=`(prod,dN) then print(i); end if;   prod:=G:-`*`(prod,dM);   end do: time()-st;

 >

## finding no solutions...

@Carl Love OK, I see your point about the hard solve. Thinking about the eigenvalues sheds some light on how hard it will be to find a solution, even if it is not computationally efficient to evaluate them. Of course there are many ways to (partly) locate and decide the types of eigenvalues, which may mean you can decide there is no solution before you get to the hard solve. A trivial example would be that there will be no solution if M is singular but N is not. Not sure how Gershgorin disks and the like carry over for finite fields.

One ends up with more equations than unknowns. Perhaps it is easier to decide if the equation are incompatible and there is no solution than is is to try to solve them.

## infinite series...

@Carl Love I'm not really serious about those, but it would be nice to get some clearer rules before I spend more time on this. If they are not OK I have a vague idea that 1 = 1/2 + 1/4 + 1/8 ... or similar series might form the basis of an infinite network solution.

## other three have same current...

@Joe Riel  But then the other three resistors have the same (zero) current. I suppose having one of the four unconnected with zero current is OK. But perhaps the problem doesn't insist on four resistors?

## version and assumptions...

In version 2015 it just returns unevaluated. But if you assume all variables positive it returns something similar to Mathematica's answer and presumably equivalent to it.

int.mw

## clarification...

@escorpsy Could you please be more specific about what you want. CauchyPrincipalValue is for singularites in the integration range, https://en.wikipedia.org/wiki/Cauchy_principal_value. Perhaps you want to do contour integration, in which case singular and residue can de used. Or perhaps your question is unrelated to the integral you gave, and is about the principal branch of the log function. The help page for ln says:

For complex-valued expressions x,  ln(x) = ln(|x|) + I*argument(x), where  -Pi<argument(x)<=Pi. Throughout Maple, this computation is taken to be the definition of the principal branch of the logarithm.

 First 13 14 15 16 17 18 19 Last Page 15 of 42
﻿