dharr

Dr. David Harrington

8355 Reputation

22 Badges

21 years, 9 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

@vv @Alfred_F I'll convert to an answer. Yes, the trick with the adjacency matrix only works for the unit triangles and doesn't find 3-5-7, since it is just finding walks of length 3. However, this is sufficient to find a black triangle. I agree it doesn't find red triangles. But since exchanging red and black is implicitly another solution, I think this still solves the problem given.

@Alfred_F I would implement your solution like this. (But I have misunderstood it; see comments below.) (Mapleprimes not displaying correctly right now.)
Edit: Added a variation using the Logic package.

Graph.mw

 

@MaPal93 I did work on it more, but I don't see how to make it more amenable to a matrix solution, though there are missing steps to matrix XX and then to the equations. As you say, it may not have a matrix formulation. Doesn't one of @C_R's worksheets get you to a symbolic solution? or maybe I misunderstood. 

Just to see if there are solutions that make sense (correct signs etc) it is perhaps worth giving parameters typical (random) values and then doing a numerical solution.

Bottom line: The fact that all the component equations have the same form argues for a matrix formulation, but the current formulation goes quickly to quadratic forms, which as scalars argues against a matrix formulation.

@salim-barzani Yes I looked at all that material, but in my worksheet I got a different (trivial answer), so I don't know what they are doing.

@salim-barzani I don't understand. For p := -4*t^3*x - 83*t^2*x^2 - 10*x^4 + 97*t^2 - 73*x^2 - 62*t + 5; what result would you want? The code I gave gets all 7 coefficients.

@michele To add to @Preben Alsholm's answer, you can change to 1D input for a single execution group if you don't want to change it for your whole worksheet - after the > prompt, type ctrl-m (command-m on a Mac) and then start typing.

@salim-barzani I don't know what the paper is doing

params2.mw

@MaPal93 I was trying this last night. If we let L=l.wsq, and multiply each eqi by w[i]^2 and add all equations we might get an equation containing only L, which could be solved for L. With L in hand, we can go back and find l[i] from each eqi. But I couldn't get it to work. (i) it also contains lsq.wsq. That could be just called X and then finding a relationship between L and X is still a step forward. (ii) I couldn't rearrange into a form containing only L (and X).

@Alfred_F Well, I used to derive physical models with pages and pages of handwritten equations. If I do the same steps with Maple, I can catch mistakes. (Particularly with signs, which as you have pointed out, are easy to get wrong.) Of course Maple can do many things I cannot easily do; my first published result of something more complicated than I could have done myself was a sum of an infinite series.

So for me, now I do everything with Maple - sometimes validating easy steps and sometimes looking for results that are complicated and perhaps unexpected. Ocassionally I do someting on paper still, but that usually involves some sort of diagram.

@janhardo The final solution seems to be the same as "ans" in my first worksheet for lambda=mu=1

@Alfred_F That's probably what Maple does, so doing those individual steps in Maple could be done, but I wouldn't say it is easier :-)

@janhardo Thanks for the worksheet. As I suspected, the sin/cos form also works without assumptions, i.e., for all lambda, mu.

restart

# Define the coupled differential equations
de1 := diff(F(eta), eta) = lambda * G(eta);
de2 := diff(G(eta), eta) = mu * F(eta);

diff(F(eta), eta) = lambda*G(eta)

diff(G(eta), eta) = mu*F(eta)

Cut and paste from @janhardo

sol := {F(eta) = (c__1 + c__2)*cos(sqrt(-lambda)*sqrt(mu)*eta) + (c__1 - c__2)*sin(sqrt(-lambda)*sqrt(mu)*eta)*I, G(eta) = (-(c__1 - c__2)*cos(sqrt(-lambda)*sqrt(mu)*eta)*I + sin(sqrt(-lambda)*sqrt(mu)*eta)*(c__1 + c__2))*sqrt(mu)/sqrt(-lambda)}

{F(eta) = (c__1+c__2)*cos((-lambda)^(1/2)*mu^(1/2)*eta)+I*(c__1-c__2)*sin((-lambda)^(1/2)*mu^(1/2)*eta), G(eta) = (-I*(c__1-c__2)*cos((-lambda)^(1/2)*mu^(1/2)*eta)+sin((-lambda)^(1/2)*mu^(1/2)*eta)*(c__1+c__2))*mu^(1/2)/(-lambda)^(1/2)}

odetest(sol, [de1, de2]);

[0, 0]

NULL

Download dsolve2.mw

 

@janhardo Since cosh(x) = cos(I*x), cos(x) = cosh(I*x) etc, I agree that there is also a sin/cos form that is equivalent to the sinh/cosh one (probably the one you show but since you didn't upload your worksheet I can't verify that). I would say they both work for all lambda, mu. Certainly one or the other is nicer for various positive/negative values of lambda, mu and I would choose the form that avoids square roots of negative numbers in practice.

But that is not really my point, which is that case (II) is incorrect as stated. The odetest fails. I have added a specific numeric example with lambda = -1, mu =-1 to my answer above to more clearly show this. It doesn't satisfy the odes with the same negative lambda and mu.  It would satisfy different odes with additional negative signs, which might be what the author meant to say, but is not the way it currently reads IMO.

For me, this has been the case for a long time. I just looked back at some Maple 18 code I wrote in 2015, and there are several cases. I can't really say reliably if this has got better or worse in later versions, but I do notice it in Maple 2024.2.

@Carl Love Thanks - I must have run things out of sequence.

First 16 17 18 19 20 21 22 Last Page 18 of 87