acer

32470 Reputation

29 Badges

20 years, 6 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Your post shows the wrong single-quote marks. They should both be left-quotes (name-quotes) and not right-quotes (unevaluation quotes) in order to use the postfix operator function `if`.

There are separate options settings for toggling Worksheet/Document and 1D/2D input modes, in the Standard GUI.

To set 1D input use the top menubar item Tools -> Options -> Display and use the top dropdown menu labelled "Input display". Set it to "Maple Notation" for 1D mode input.

In a Worksheet, the F5 function key toggles the cursor between 1D Maple input and 2D Math input (on Linux, so use the shortcuts for your OS). You can tell which mode the cursor is currently accepting visually: the cue is a slanted cursor for 2D and a vertical cursor for 1D mode.

acer

The name `&where` is that of a Library routine. You can use showstat() to look at its source.

I believe that it is used by pdsolve, and that it can appear in output as a mechanism for qualifying results. See ?pdsolve and look for references to PDESolStruc .

You may also already know this, but if you create a procedure whose name begins with & then it can be used as an infix operator. So in you example a &where b is pretty much the same as calling `&where`(a,b).

acer

> m:=[1,5,3]:

> p := proc(L::uneval)
> local thelist;
> thelist:=eval(L);
> seq( cat(L,thelist[i]), i=1..nops(thelist) );
> end proc:

> p(m);
                                  m1, m5, m3

acer

> kernelopts(printbytes=false):
>
> p := "(0.575849 Cos[0.383015 t] Sin[0.383015 t] -\
>     1.66533*10^-16 Cos[2.33523 t] Sin[0.383015 t] +\
>     1.11022*10^-16 Cos[0.383015 t] Sin[2.33523 t] +\
>     1.01122 Cos[2.33523 t] Sin[2.33523 t])^2 + (0.462311 Cos[\
>       0.383015 t]^2 + 3.33067*10^-16 Cos[0.383015 t] Cos[2.33523 t] +\
>     0.537689 Cos[2.33523 t]^2 - 0.462311 Sin[0.383015 t]^2 -\
>     1.38778*10^-16 Sin[0.383015 t] Sin[2.33523 t] -\
>     0.537689 Sin[2.33523 t]^2)^2 == 1":
>
> eq := MmaTranslator:-FromMma(p):
>
> Digits:=30:
> s1 := fsolve(eq, t);
                                                           -7
                  s1 := 0.111758779601256604676477981151 10
 
> eval(eq,t=s1);
                     0.999999999999999999999999999998 = 1
 
>
> s2 := fsolve(eq, t, avoid={t=s1});
                                                           -7
                 s2 := -0.111758779601256604676477981151 10

acer

Is t\[Tau] = 0 a solution? Did you need some other, nontrivial solution?

Did you want a real solution? (I'm not sure that one exists.) If not, then how about,

t\[Tau] = 1.0
HBar = -0.7334865113 - 0.7613376564*I

Or are you looking for some sort of characterization or parametrization of all the solutions as a relation between t\[Tau] and HBar?

ps. It is easier for us if you use Maple syntax.

acer

As shown above, solve() can deal with this example nicely. But LinearSolve does not handle the initial problem nicely, and won't produce an answer until the RHS is instantiated at some partial solution (ie. an instantiation of the RHS which makes the system's conditional consistency more apparent).

A natural question to ask is whether LinearSolve might be made smarter, to get the solution itself right away on the original input with the symbolic RHS.

For LinearSolve with method=LU, it might compute something like the following.

> LUDecomposition(Matrix([a,b]),output=':-U')[Rank(a)+1,1..-1];
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 
    -2 + exp(-2 B J_1 + B J_2) + exp(2 B J_1 + B J_2)]

The question then would be, how show a qualifying proviso alongside a returned result, that would usefully show that the augmented right-most entries of the above must equal zero for the result to hold?

And then there is method=solve to deal with. That is actually the method currently getting used for LinearSolve(a,b), as userinfo messages show. And it forms the equations and then calls SolveTools:-Linear. And that call is returning NULL. So it'd be desirable to figure out why, and how it might be avoided or followed up with a more general `solve` call, etc.

acer

I see no Matrix in use in this code. What I see are tables M and L, in the 2nd code.

Your claim, "changed my code to multi-threaded type" doesn't look true to me. Both 1st code and 2nd code use Threads in the same way, no? Isn't the only difference that of using tables versus using integers?

I don't know what paper you refer to, and what sort of data it deals with. Maybe it is discussing access of Maple's immediate integers versus other data. Maybe a more appropriate comparison would be with small integers versus entries of a pre-allocated datatype=integer[8] Matrix, But then, I'm not sure why you'd want to muddy the waters of a comparison of that issue by wrapping it all up in Threads use.

acer

Have a look at the help-page ?INTERFACE_HELP

I believe that a general strategy could be something like this,

  • copy an entire existing help-page to an empty session Worksheet.
  • edit it to taste
  • save it as some new .mw file
  • run INTERFACE_HELP on that .mw file

I'm not sure whether you have to worry about libname, and create a new empty .hdb help archive file (found first in libname), so as to ensure that the no previous "system" .hdb gets written to by mistake. The INTERFACE_HELP help-page suggests that it is so, however. So, before running INTERFACE_HELP make sure that some location owned by you is first in libname. (And then, it remains to be seen, whether it will form a new .hdb for you, or not...)

acer

In your first attempt, you are trying LinearSolve with the zero-vector as the right-hand-side. Maple is saying that that system is inconsistent. But then you use quite a different, nonzero rhs in your solve call.

The solve call (as below, and not wrapped in an assign call) produces three results. For each of those, the rhs seems to evaluate to a Vector with all entries equal to 1 (just with differing values of B, J_1, and J_2 to get that).

gl1 := t[11] + t[13] + t[31] + t[33] = exp(2*B*J_1 + B*J_2):
gl2 := t[21] + t[23] + t[31] + t[33] = 1:
gl3 := t[11] + t[13] + t[41] + t[43] = 1:
gl4 := t[12] + t[13] + t[32] + t[33] = 1:
gl5 := t[11] + t[14] + t[31] + t[34] = 1:
gl6 := t[21] + t[23] + t[41] + t[43] = exp(-2*B*J_1 + B*J_2):
gl7 := t[22] + t[23] + t[32] + t[33] = exp(2*B*J_1 - B*J_2):
gl8 := t[21] + t[24] + t[31] + t[34] = exp(-2*B*J_1 - B*J_2):
gl9 := t[12] + t[13] + t[42] + t[43] = exp(-2*B*J_1 - B*J_2):
gl10 := t[11] + t[14] + t[41] + t[44] = exp(2*B*J_1 - B*J_2):
gl11 := t[12] + t[14] + t[32] + t[34] = exp(-2*B*J_1 + B*J_2):
gl12 := t[12] + t[14] + t[42] + t[44] = 1:
gl13 := t[22] + t[24] + t[32] + t[34] = 1:
gl14 := t[21] + t[24] + t[41] + t[44] = 1:
gl15 := t[22] + t[23] + t[42] + t[43] = 1:
gl16 := t[22] + t[24] + t[42] + t[44] = exp(2*B*J_1 + B*J_2):
 
a,b:=LinearAlgebra:-GenerateMatrix(
 {gl1,gl2,gl3,gl4,gl5,gl6,gl7,gl8,gl9,gl10,gl11,gl12,gl13,gl14,gl15,gl16},
 [t[11],t[12],t[13],t[14],t[21],t[22],t[23],t[24],t[31],t[32],t[33],t[34],
  t[41],t[42],t[43],t[44]]);
                                                                                
LinearAlgebra:-LinearSolve(a,b);
 
s := solve({gl1, gl2, gl3, gl4, gl5, gl6, gl7, gl8, gl9, gl10, gl11,
            gl12, gl13, gl14, gl15, gl16});
 
nops([s]);
 
seq(eval(b,[s][i])^%T,i=1..nops([s]));
 
LinearAlgebra:-LinearSolve(a,eval(b,[s][1]));

acer

An important difference between,

(evalf@eval(f))/10^Digits;

and,

(evalf@f)()/10^Digits;

is that the latter involves a function call. The latter applies evalf@f to () which means it calls it with null arguments. That's why it returns a float when used in exactly that way inside `uniform`.

On the other hand, the former variant doesn't apply evalf@eval(f) to anything, and so just gives a procedure as the returned result from `uniform` instead of some specific float value. That procedure result is what gets assigned to U, in the programming guide. And calls to that U then result in varying numbers.

Your posted version of `uniform` contained the form (evalf@f)()/10^Digits , which doesn't match the version in the guide. But it differs in the way described above, by being a function call, as well as by omitting the eval().

Maybe you would be interested in forming procedure `uniform` with the variant,

(evalf@f)/10^Digits;

and then considering the behaviour from that? Or, has your understanding of the need for the eval() already been made clear? And it's just the difference between applying a proc and "applying" a number (which just returns that same number) which you wonder about?

acer

Are you after something like this,

> restart:
> assume(b > 0);
> x := b+1;
                                  x := b~ + 1
 
> x:=subs(b='b',x);
                                  x := b + 1
 
> b:='b';
                                    b := b
 
> about(b);
b:
  nothing known about this object

acer

What happens if you try to assign evalf(Pi,1000000) to a name (variable) and then end the line with a colon so as to supress printing of the result?

acer

You can use the time() command to measure how long a computation takes. See the help-page ?time for more details.

You might also be interested in ?profile and ?nprofile. The routine showtime() seldom gets mentioned, so maybe it is unpopular.

Note that, for a general program (which may not do numeric solving in repeated steps) the concept of "iterations" is not always meaningful. Even a command like Matlab's flops() doesn't make much sense in a computer algebra system.

It's likely off topic, but you might possibly be interested in ?SoftwareMetrics .

ps. flops no longer available in current Matlab. Some discussion, taken at pseudorandom.

acer

Try emailing it to support@maplesoft.com .

acer

You may want to contact support@maplesoft.com

Without seeing the actual code it's difficult to tell whether it is exiting due to some limit near 500MB, or whether it is sitting at 500MB and failing to further allocate memory way past 2GB for some new rtable object. I would guess the latter, but without seeing the code cannot tell how it maybe made to work.

You might also consider uploadind your code to this site using the green up-arrow to access the site's FileManager.

acer

First 315 316 317 318 319 320 321 Last Page 317 of 337