Carl Love

Carl Love

28100 Reputation

25 Badges

13 years, 106 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@oldstudent I highlighted.

While "Numerically Solve" will usually give the same results, the process used to obtain the results is vastly different.

Preben: Thanks for the information. I edited the Answer to reflect it.

@Markiyan Hirnyk I did read the help for GlobalOptima and I still can't tell why it returned such an answer for the OP's command. It doesn't matter if the constraints are changed to {x >= 0, y >= 0, z >= 0, x+y+z = 3}; it still doesn't work.

I immediately foresee numerous problems with your plan. My advice is to give up and use strings. Note that there are a few syntaxes that have been developed for the unambigous one-dimensional input of chemical formulae. Look up SMILES and SYBYL in Wikipedia.

@acer At the risk of going more tangential....

The concept of gc real time and how to measure it does not quite make sense to me. The only way that I can make sense of it is if the processing of all the other Maple processes is suspended while gc is being done. Do you know if that is true?

Please give your equation in normal characters (Maple 1D input) or attach a worksheet. What you have posted as your equation is meaningless to Maple.

@brian bovril Okay, here's a procedure to do it.

Display:= proc(res::list(indexed=nonnegint))
local S,e;
     S:= `%+`(seq(`if`(rhs(e)=0, [][],
          `if`(rhs(e)=1, ithprime(op(lhs(e))), `%*`(ithprime(op(lhs(e))), rhs(e)))
          ), e= res
     ));
     InertForm:-Display(InertForm:-Value(S) = S)
end proc:

Now just make the last line PF

Display(res[2])

@acer 

`<>` is just the prefix form of the not-equals operator. The Vector/Matrix constructors are `<,>` and `<|>`. If I call showstat on them, they do not seem builtin. I have however noticed that they are faster than Vector and Matrix. I don't see how that can be since they just call Vector and Matrix.

@acer wrote:

I don't offhand see an easy way to use map[4] and the 'rtable' constructor while avoiding the extra layer of a custom operator (as in my revision above).

Here's a way that uses no non-builtin operator (I consider ArrayTools:-Alias as builtin since it's external code).

map(
     ArrayTools:-Alias,
     map2(rtable, 1..m*n, CartProd([[$0..p-1] $ m*n]), subtype= Matrix),
     [m,n]
):

And it makes a significant time improvement, I think.

I realized before you posted that it was the call to Matrix that was killing my timing. Matrix is a bloated 200-line Maple-language procedure.

Joe: The timings for Iterator are impressive, especially when the output is used in Iterator's native rtable form. I've only previously timed it using the output in list form.

@H-R 

I wanted the code to be repeatable. Thus, it is necessary to delete the file if it already exists. However, if the file does not exist (such as on the first run of the program), the Remove command will give an error. The try ... catch: ... end try command "traps" the error, so that it can be ignored. The code which may generate the error comes immediately after the try. If there is something special to do when the error occurs, that comes after the catch. In this case, there is nothing that needs to be done. However, the syntax requires the presence the word catch: anyway. See ?try .

@Stephen Forrest 

It would be nice to be able to run Part1.mw more than once, i.e., if MyNewArchive.mla already exists.

@Markiyan Hirnyk 

You didn't execute the code that defines result. That is clear from the label on the horizontal axis. This is the plot that you should get

What sum knows about this seems very basic to me. Consider this generalization of your example:

sum((-1)^k*(f(k) - a), k= 1..n);

@Markiyan Hirnyk 

Your code is remarkably simple, and I'd wager that it'd come in second place timewise among the current contenders. 

@derekcowley 

See ?simplify,siderels . The command uses a Groebner basis. The efficiency of that famous algorithm is notoriously sensitive to various factors, most notably the "monomial ordering."  It is however a true algorithm: It is guaranteed to give a result fully reduced with respect to the side relations given sufficient time and memory.

Note that your side relations are eight cubic polynomials each with nine terms. Try reducing that complexity by using left sides that are pairs of factors rather than triples. Or apply the side relations one at a time (in a series of simplify commands).

@Joe Riel 

Joe: +1 for the syntax in P do f(M) end do. It's surprising that no explicit call to g is needed in the loop. That being the case, pointers h and are not needed. So the code can be further abbreviated to

(m,n):= (2,2):
P:= Iterator:-MixedRadixTuples([2 $ m*n]):
M:= ArrayTools:-Alias(ModuleIterator(P)[2](), [m,n]):
in P do printf("%{}d\n\n", M) end do:

Markiyan: It looks like you don't have a compiler in Maple 16. Change your call to MixedRadixTuples to MixedRadixTuples(..., compile= false): Doing this, I got it to work in Maple 16.

First 527 528 529 530 531 532 533 Last Page 529 of 709