In a concurrent thread I posted the following simplification procedure
Tryhard:= proc(expr) global E_in_Tryhard; subs(pow= `^`, codegen[optimize](subs(E_in_Tryhard= expr, ()-> E_in_Tryhard), tryhard))() end proc;
and now put into an extra blog post, as it might be helpful for others. Note, that this does not work on all constructs in Maple and certainly the package is a bit dated.
I am missing the F1-help to work properly after highlighting words at least for the following invfourier ---> completely missing (it is in inttrans) invlaplace ---> completely missing invmellin ---> completely missing fourier ---> MTM[fourier], but not inttrans Parts ---> completely missing (expect it in IntegrationTools) Flip ---> ImageTools[Flip], but not to IntegrationTools Change ---> selection, but no IntegrationTools
I recently discovered a minor variation on the technique of building a set using a table. The purpose for using a table rather than inserting new items directly into a set is that, in a loop, the latter technique is O(n2) rather than O(n). The way I would normally do this is to assign a counter and an empty table, and then, in a loop, compute the new element, increment the counter, and insert the element into the table at the counter index. For example,
solve used to be one of Maple's strongest commands -- it even subsumed simplify in power. But, over the years, dsolve slowly took over as the most powerful comand. At the same time, people started realizing that within the framework of differential equations, the toolbox was actually larger than the one for algebraic equations (and most algebraic tools are still available). So many tasks that one thinks of doing purely algebraically can also be done using differential equations, with perhaps the most surprising one is to factor multivariate polynomials via partial differential equations.
We are going to show a roundabout but rather effective method of solving some rather complicated (definite) integrals in closed-form via a rather unusual method: a special factorization of linear ODEs. The example we will use is a 2 week old question that has yet to get an answer.
First, the problem: compute the integral
In the recent discussion about patching, a question about patching a function f including local variables of a module or another function was discussed. For example, let it be defined as
A:=proc() global f,t; local x,y,z; f:=()->x+y(); y:=()->z; t:=()->x+z; x,z:=0,1; NULL end: A();
Now,
op(f);
() -> x + y()
f();
1
How to change it so that it would return 2 instead of 1, without reassigning it?
Everybody is invited to Maple Wiki .
It is hosted on Maple Advisor, a Maple community site independent of Maplesoft and/or Mapleprimes.
The site has started just a couple of days ago and doesn't have much of a content yet.
I was reminded of this by another thread.
It is faster to add in-place a large size storage=sparse float[8] Matrix into a new empty storage=rectangular float[8] Matrix than it is to convert it that way using the Matrix() or rtable() constructors.
Here's an example. First I'll do it with in-place Matrix addition. And then after that with a call to Matrix(). I measure the time to execute as well as the increase in bytes-allocated and bytes-used.
> with(LinearAlgebra):
> N := 500:
> A := RandomMatrix(N,'density'=0.1,
> 'outputoptions'=['storage'='sparse',
> 'datatype'=float[8]]):
> st,ba,bu := time(),kernelopts(bytesalloc),kernelopts(bytesused):
> B := Matrix(N,'datatype'=float[8]):
> MatrixAdd(B,A,'inplace'=true):
> time()-st,kernelopts(bytesalloc)-ba,kernelopts(bytesused)-bu;
0.022, 2489912, 357907
In a recent post, a Maple user misunderstood what an assignment to f(x) meant. Since this is a common source of confusion, I thought it would be worthwhile to say more about this subject.
What is f(x)?
First, f(x) is a "function application" in Maple. It is f applied to the argument x. It is not really the same as what one thinks of as a function in mathematics. Consider a mathematical function such as sin(x+y). In Maple, this can be represented by an expression sin(x+y) or a procedure proc(x, y) sin(x+y) end proc (which can also be written in "operator form" as (x, y)->sin(x+y)). The expression or the procedure can then be assigned to a name such as g. The mathematical function is then represented by g in Maple, and not by g(x, y). Instead, if g is a procedure, then g(x, y) means "the procedure g called with arguments x and y". The "function" help page explains these concepts in more detail.
What is f(x):=x^2 in 1-d math?
Now let's move on to what f(x) := x^2 means. In 1-d math, this means, "Create a remember table entry for procedure f." This stores the expression x^2 so that when you enter f(x), that expression is automatically retrieved, and you avoid the expense of executing the body of the procedure . Similarly, if you enter f(1) := 5, then the value 5 is automatically returned when you enter f(1). Note that if you subsequently enter f(y), you won't get y^2 returned, unless f was already defined to return y^2 with input y. Remember tables are very useful and are heavily used by some Maple library procedures. However, the majority of Maple users do not need to worry about this feature and can do very useful things in Maple without ever knowing about it.
Maple is missing the 'standard' notation for the cumulative normal distribution and uses the error function instead (for historical reasons I guess).
However that would be quite convenient to read and formulae in a common notation.
3 hours 4 min ago
3 hours 36 min ago
5 hours 50 min ago
5 hours 59 min ago
6 hours 7 min ago
9 hours 10 min ago
10 hours 34 min ago
11 hours 47 min ago
11 hours 52 min ago
12 hours 34 min ago