dharr

Dr. David Harrington

8270 Reputation

22 Badges

20 years, 359 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

@philroe Yes, sort should work on anything; try it on your examples or upload your worksheet if it doesn't seem to be working.

@C_R Nice.

The large y values that don't give reality seem to correspond to the same values of m and m2, but these are supposed to be in different ranges, so something not quite right there. I'm not sure about how those ranges were chosen; I do not fully understand the physics.

I agree with your approach with x as a parameter (or we could try z). The exponents are no longer integers, which makes it a much harder problem than before. It think we are close to a phase transition (at d=3?), in which by definition (in an infinite system) the solution is non-analytic/has a singularity. So we expect it to be numerically very difficult. Perhap your sequence of x values found the phase transition, Perhaps it can be approached from the other side and goes crazy at the same point.

@C_R @Gabriel Barcellos @one man I made some progress in analyzing the expressions and squeezed another 50% efficiency out of the some of the earlier parts of the worksheet. I still intend to tackle the more difficult case of solving the three equations for T. Some observations that are speculative at the moment:

1. I think my efficiencies largely arise from efficient evaluation of multivariate polynomials in Maple, and once you go to another form you lose efficiency.

2. Perhaps related to the previous point, making a function with unapply or makeproc leads to much, much slower evaluations.

3. The efficiency of fsolve depends significantly on how the equations are presented - expression or functions. This is more than just efficiency of evaluations, because in all 3 cases I tried, fsolve uses the same method and the same internal initial guess, but the estimated errors and the number of iterations changes a lot. 

@C_R asked about the physics. There are 8 spins on the vertices of a cube, each of which can take on 8 spin states (those in S0). Z0 is the partition function, the sum of the exp() expressions, one for each of the 8^8 states (possible arrangements). m is the resulting magnetization. I'm not clear on the meaning of the requirements at the end, where T is solved for for close values of d.

Campo_Médio_spin_7_2_new5MP.mw

@mmcdara This capability still exists; try

interface(prettyprint = 2, typesetting = standard, labelling = true, labelwidth = 10)

on eq3, but in this case there are not enough large subexpressions, and the main expression is one line long. I recall it being more flexible, but maybe not.

@MDD I updated it slightly. TestOrder is supposed to see monomials

You didn't say what to do with 2*x^2 as a leading term vs x^2, or other possibilities. sort already has a default "lex" order for monomials:

[x, x^2, y^2, y^3, x^2*y, y^2*x, 2*x, 2*x^2]

Is that OK?

I'm assuming you don't care about the order within the sublists?

There are some similar pictures (not the motorcycle available here for download https://www.mapleprimes.com/posts/220466-Plots-Using-Only-Single-Implicit-Functions

It is interesting that :-solve(eq, x) assuming x>0 gives a RootOf and not just nothing, even though they are supposed to be equivalent.

As transcendental equations are unlikely to have exact solutions, I can see why Maple doesn't try too hard on this, which seems to be a special case,

@salim-barzani OK, I see what you did. The problem is actually with the last line, which needs to substitute the case 1 variables.

problem2.mw

I highlighted an unexpected "and" in your input. implicitplot3d is expecting an equation or expression. Please check the code is exactly as in your source. In general it is helpful if you upload your worksheet. Use the green up-arrow Mapleprimes editor, choose the file to upload, click upload and then click one of "insert link" or "insert contents".

@Carl Love You are right. I passed x to the procedure, not a number.

@C_R Yes, you can just subs into a procedure. 

myproc3 := subs(sin = cos, eval(myproc2));

Edit: evalhf@sin also works, I was mistaken earlier. See @Carl Love's comment.

proc.mw

@Saalehorizontale The answer to your original question is that it is a bug in Maple. In the middle of solving, some routine passed something invalid to SolveTools:-Inequality, so that should not have happened.

In your second approach solve is unable to find solutions. I don't know why that is, but solve may try many different "subsolvers" and didn't make a good choice.

In your third choice, the strange output is the output of the parametric solver - as you get with solve(...,parametric). The first line gives a solution that applies for some complicated conditions, the second line says that there are no other solutions (not that it couldn't find one).

I've found that solving with inequalities other than simple ones like k>0 is difficult - Maple can in principle do it but it takes too long in practice, or sometimes gives errors. To go beyond "solve" you get some control over the method used may help. @John May suggested SolveTools:-Algebraic, but there is also the RegularChains package especially RealTriangularize. (solve is supposed to call these as needed.) All of these are for polynomial systems so the presence of sqrt(x) in your systems could be a problem. You can solve that by replacing sqrt(x) with q and then adding an equation q^2 = x.

@Gabriel Barcellos When T is an input, e.g., when solving {eqTPO, eqm, eqm2}, x and beta are given, so you are solving equations in y, y2 and z that have integer exponents; finding y, y2 and z is finding m, m2 and d. But each of x,y,y2 and z depends on beta, so to solve for beta you have to "break apart" these variables. You could write exp(beta) as E and then have equations involving E, but the exponents are no longer integer, so it is much slower (I tried this). So that is not much different from just replacing y etc with the exp() functions, which is just the original slow equations. I tried solving a larger system where the complicated expression did not have exponentials, and the other equations had one each, but this also didn't work - perhaps because of some internal processing fsolve does.

I tried compiling some of these procedures, but it was taking too long. I'll give it a bit more thought. Is is possible that instead of specifying d and finding T, you could specify T and find d?

fsolve allows an initial guess, so as you change d, in principle you can use solution from the last d as a guess. I tried this but it is actually slower, which can sometimes happen. Could you narrow the search ranges - it is still rather wide for T.

@Carl Love You can count 3-cycles this way, but not larger ones. Consider a length 4 walk that goes 2 steps away and then reverses those two steps. This contributes to a non-zero trace for A^4, but is not a cycle.

First 13 14 15 16 17 18 19 Last Page 15 of 86