dharr

Dr. David Harrington

3252 Reputation

17 Badges

18 years, 39 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 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.

MaplePrimes Activity


These are replies submitted by dharr

@panke I thought you wanted to remove the assumption, but maybe you wanted to remove the tilde, which @Rouben Rostamian has told you how to do. I do not understand your point above.

@mmcdara V=~0 is not a solution because of 0/0, but perhaps it is a solution to the original problem before it was manipulated into this form. I agree there is something strange about the system; perhaps for other values of the OP's free parameters it has clearer solutions.

@mmcdara I dont understand your final comment, since your minima have mu__jk=mu__ki; they also have the lambdas with the same magnitude. You are right this is a tricky problem for fsolve (so needs careful checking increasing Digits and perhaps the fulldigits option), but minimizing only finds one of the solutions, and prseumably all solutions are sought.

If you put all the equations in numer/denom form with normal, then take the numerators, then all variables=zero is a solution:

V=~0;
eval(map(numer@normal,Eqp),%);

gives zeroes. The numerators are all multivariate polynomials, though not sure if this helps.

@MaPal93 Here's how I would collect output of fsolve into a Matrix: fsolvecollect.mw

I think your premise that the different solutions of fsolve differ because of convergence issues is not correct; they are separate accurate solutions of the set of equations. To verify this, you could set Digits:=20; and see that almost all of the digits you currently get are accurate.

To put values back into alpha etc use eval: eval(alpha,{mu=2,s=3})

To vary the parameters means putting things into some sort of loop; a lot depends on how systematic you want to be.

@MaPal93 It seems very unlikely there is an analytical solution; solve already will try many algorithms.

@MaPal93 

  • what the ^+ does at the SMI step (4th line)
    It means transpose (%T is an alternative), so SMI is a row vector, as you wanted.
  • why in natlq2 and natlq3 steps SMI2 and SMI3 are not transposed (see your initial comment) before being multiplied by Y
    I think the above probably already answers that. The row vectors SMI2 and SMI3 multiply the column vector Y to give a scalar. (The usual dive row down column and add, which in this case amounts to a dot product.)

For fsolve, you get one root (at least in my earlier version of Maple). To find others you will need to help fsolve. If you are lucky, use the avoid option to avoid this one next time and then so on. Or you can give ranges within which you can find the root of interest, or you can give initial guesses (less reliable in my experience). Maple has optimizers if you need to go that route.)

See my answer here. But also maxsols=8 may work without these tricks.

@MaPal93 I don't understand; your newly updated document has no LinearSolve. I used worksheet mode originally because I am most familiar with it, but have done the updated one in document mode - see the added document to my answer above. Run the document, and remove the colons to see the answers. The answers are extremely long; I'm not sure they will be useful.

ans1 is a 1..3, 1..13 Array, as may be seen by changing the : to ;. So ans1[12..14,3] leads to an indexing error, since 12 is not in the range 1..3.

By the way, why not just export the Array contents directly, rather than extracting them from a plot?

@ijuptilk Sorry, forgot about discont only for 2D. But at least in Maple 2015 I am not seeing a problem, though I didn't explore all ranges.

plot3d(y/(x+1)+1/(y^2-y), x = -3 .. 3, y = -3 .. 3, view = [default, default, -8 .. 8],
 style = surfacecontour);

gives

 

@ijuptilk use discont=true if there are discontinuities.

@Carl Love Excellent effort, going beyond. Vote up.

@mehdibgh Here's an example - words refers to memory usage. (The second PrintProfiles is for both calls to test.)
 

restart

with(CodeTools:-Profiling):

test:=proc(V,n)
  local i;
  for i to n do
    V(i):=i^2;
  end do;
  V;
end proc:

V := Vector[row]()

V := Vector[row](10, {(1) = 1, (2) = 4, (3) = 9, (4) = 16, (5) = 25, (6) = 36, (7) = 49, (8) = 64, (9) = 81, (10) = 100})

Profile(test);

test(V, 5)

Vector[row]([1, 4, 9, 16, 25, 36, 49, 64, 81, 100])

CodeTools:-Profiling:-PrintProfiles(test);

test

test := proc(V, n)
local i;
     |Calls Seconds  Words|
PROC |    1   0.000    191|
   1 |    1   0.000      0| for i to n do
   2 |    5   0.000    191|   V(i) := i^2
                            end do;
   3 |    1   0.000      0| V
end proc

test(V, 10)

Vector[row]([1, 4, 9, 16, 25, 36, 49, 64, 81, 100])

CodeTools:-Profiling:-PrintProfiles(test);

test

test := proc(V, n)
local i;
     |Calls Seconds  Words|
PROC |    2   0.000    286|
   1 |    2   0.000      0| for i to n do
   2 |   15   0.000    286|   V(i) := i^2
                            end do;
   3 |    2   0.000      0| V
end proc

``

 

Download Profile.mw

Maple has the CodeTools:-Profiling package to help you find where these limitations are. As a first step, you can put the critical part in a procedure and pass it to CodeTools:-Profiling:-Profile - see the help page for that.

@Ronan For URLs I think you need forward slashes always. For Maple filenames, forward slashes always work (platform independently), but on windows backslashes work, but need to be escaped, i.e., \\ is \

(I said the text file is opened by notepad, but actually it is by the browser.)

1 2 3 4 5 6 7 Last Page 1 of 31