dharr

Dr. David Harrington

8330 Reputation

22 Badges

21 years, 3 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

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

MaplePrimes Activity


These are replies submitted by dharr

@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.

@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?

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

@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.
 

@escorpsy I don't understand. evalc(ln(x+I*n)) (i.e. assuming x and n real) returns (1/2)*ln(n^2+x^2)+I*arctan(n, x), which explains where all the arctans are coming from. I don't see simplify getting rid of imaginary parts. In terms of the integral, if you try integrating from 0..p you will be asked about various assumptions, so I'm not sure Maple can correctly do this integral without knowing more about the symbolic parameters.

As @Axel Vogt points out there are problems with the integral to infinity for nonzero p. You can try singular(integrand,q) to find the singularities. 

@escorpsy 

II:=int(q*(ln((-(w+t)^2+(q+p)^2-I*n)/(-(w+t)^2+(q-p)^2-I*n))
    +ln((-(-w+t)^2+(q+p)^2-I*n)/(-(-w+t)^2+(q-p)^2-I*n))), q=0..infinity,'CauchyPrincipalValue'):
simplify(II) assuming positive;

Leads to infinity plus a long expression.

@lcz Very nice. Looking through the paper, it seems that rather than take the pseudoinverse of L, you can take the regular inverse of L+(1/n)*J, where J is the matrix of 1's. (The wikipedia page seems to have missed this point.) Since you are not making use of GraphTheory's LaplacianMatrix, and making your own weighted version, you may as well generate the above matrix directly (called LJ in the code). Its diagonals are chosen so the row/column sums are 1. I'm assuming the regular inverse is more efficiently calculated than the Moore-Penrose pseudoinverse, though I didn't check. This leads to the code below (works for weighted and unweighted graphs).

ResistanceMatrix:=proc(G::Graph)
  local W,M1,LJ,n,X;
  uses GraphTheory;
  if IsDirected(G) then error "Must be an undirected graph" end if;
  if IsWeighted(G) then W:=WeightMatrix(G) else W:=WeightMatrix(MakeWeighted(G)) end if;
  n:=upperbound(W)[1];
  M1:=Matrix(n,n, (i,j)-> if W[i,j]<>0 then 1/n-1/W[i,j] else 1/n end if,'shape'='symmetric');
  LJ:=M1+LinearAlgebra:-DiagonalMatrix(Vector(n,1)-MTM:-sum(M1,2));
  X:=LinearAlgebra:-MatrixInverse(LJ);
  Matrix(n,n,(i,j)->X[i,i]+X[j,j],'shape'='symmetric')-2*X;
end proc:

weightedResistanceMatrix.mw

@mmcdara @Carl Love Thanks for the appreciation. It seems like a deficit (bug?) that convert(..,LegendreP) here works while convert(..,LegendreQ) doesn't, though maybe some appropriate assumptions are needed. Since there were already complex arguments it wasn't obvious what they might be. I chose the change of variables so that z was the main argument of LegendreP. Ironically, if it hadn't half worked, I wouldn't have figured it out. I suppose that change of variables made the ode look more like the standard Legendre one.

Converting back does give slighly different hypergeoms, which no doubt are equivalent through some known relationships, but I'm not sure much can be concluded from this. 

You have edited your original question to be a different one, so the old answer no longer makes sense. To ask a related question in the same thread just reply to yourself. If it is a completely new question, start a new question. 

To have multiple plots of the same ode with different initial conditions use DEplot in the DEtools package. But you say you want a contour plot - you will need to specify more exactly what you want to get help with that.

@mskalsi Since you assigned to xi[1] and xi[2], xi is a table. So you cannot now use xi as a simple name. If you really want to do that, you need to use xi__1 and xi__2 (double underscore - also looks like a subscript). As @Axel Vogt says, eval works better than subs. But here to set (x^2+y^2)/2 to xi, you might have to use algsubs.

In terms of the specific question about how to plot a tetrahedron, you can supply a list of 4 points to tetrahedron in the plottools package. But that gets you a solid figure, and I think you want the lines. So the attached shows how to get lines beteeen all pairs of points and plot them. (You may have all the pairs already in your code, since those are the distances you wanted to be integer).

tetrahedron.mw

@tomleslie The simpler

assign(sol)

works here. Of course I agree with your advice on using eval instead of assign.

@vv Thanks for the clarification.

@vv Nice. Perhaps I'm missing something, but it seems to me that this can be set up as a group with the set X as identity, and let Maple do the work. But it gives me an error message in my version (bug?), so I can't test it.

with(GroupTheory):
X:={1,2,3};
C:={{1},{2}};
g:=CustomGroup(C,inverse=(a->X minus a),multiply=`union`);
Elements(g);

 

First 59 60 61 62 63 64 65 Last Page 61 of 87