acer

32587 Reputation

29 Badges

20 years, 38 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

I believe that the "Enable SMP support" option refers to which Maple kernel gets run. The two choices in Maple 11 are mserver and mtserver. The first of those is the usual kernel. The second is one in which the Threads package can be run (and may not be quite as stable). You may also be able to tell which one you are currently in by issuing the command kernelopts(multithreaded) .

But even without that SMP support option toggled, you can still enable separate kernels for separate worksheets/Documents. Whether to do so depends on whether you want all assignments and data to be accessible across your open documents within a single session. (I almost never want this, not so much because I want the benefit of utilizing multiple cores, but more because I don't want each window clobbering data or variables in the other. So I usually have it set to "new engine for each document", or "ask each time".)

I believe that on a multicore system distinct document windows running distinct kernel instances can use distinct cores (if available, just as the GUI itself can use one distinct from that which the kernel uses), even without the SMP option enabled. Hopefully someone will correct that statement, if it's wrong. That little paragraph below the SMP checkbox on the Options popup doesn't have much content.

So, the "Enable SMP support" and "New engine for each document"  options appear to be pretty orthogonal.

acer

You may be interested to learn that the ArrayTools:-Alias routine does not make a full copy of the data. What it does, instead, is provide an alternate view of the data.

Suppose for example that V is a 1-D Alias view of some M, a 2-D Matrix, where one of V or M had been created by an ArrayTools:-Alias call on the other. These two names, V and M point at the same data. Changing an element in one will show up if accessed from the other, and vice versa.

This makes Alias very popular, as it allows a no-copy bypass around difficulties where one routine produces a Matrix and another routine expects a Vector, and one wishes to pass the same data back and forth. No extra storage is used up, by the Alias call. And no extra time is taken for copying elements from one structure to another.

This may be useful, with respect to the last section in the above uploaded worksheet. The convert() calls may be avoided altogether, I suspect. A code fragment might look something like this, where b is the data Matrix,

m,n := LinearAlgebra:-Dimension(b);
d := ArrayTools:-Alias(b,[m*n]):
LinearAlgebra:-Normalize(d,inplace);
Img := ImageTools:-Create(b):
ImageTools:-Entropy(Img);

acer

Does this do the same thing? It acts about 20 times faster (on my machine) for a 500x500 Matrix with random integer entries between 1 and 4.

ShannonEntropy := proc (a::Matrix)
local i, L, m, n;
  m, n := LinearAlgebra:-Dimension(a);
  L := Statistics:-Tally(ArrayTools:-Alias(a,[m*n]));
  return -add(rhs(i)*log[2](rhs(i)/(m*n)), i in L)/(m*n);
end proc:

If there's some difference in behaviour, then it could likely be easily sorted out.

acer

The first line of the help-page for RootFinding:-Isolate says that it is for finding real roots. All the roots of your system above are nonreal, ie. they all have nonzero imaginary components.

RootFinding:-BivariatePolynomial finds them.

For the sake of mentioning it, there is also the syntax,

solve([E2,E1],[x,y],AllSolutions,Explicit);

which does not require setting environment variables beforehand.

acer

The first line of the help-page for RootFinding:-Isolate says that it is for finding real roots. All the roots of your system above are nonreal, ie. they all have nonzero imaginary components.

RootFinding:-BivariatePolynomial finds them.

For the sake of mentioning it, there is also the syntax,

solve([E2,E1],[x,y],AllSolutions,Explicit);

which does not require setting environment variables beforehand.

acer

plot(t->evalf(Int(cos((1+sin(x))^(1/2)),x=0..t)),0..5);

Or,

f:=cos((1+sin(x))^(1/2)):
plot(t->evalf(Int(eval(f,x=X),X=0..t)),0..5);

acer

plot(t->evalf(Int(cos((1+sin(x))^(1/2)),x=0..t)),0..5);

Or,

f:=cos((1+sin(x))^(1/2)):
plot(t->evalf(Int(eval(f,x=X),X=0..t)),0..5);

acer

Just enter this directly into Maple (with the question mark), and hit return:
?IterativeSolver

Or enter this into the help-window's search field (without the question mark):
IterativeSolver

acer

Just enter this directly into Maple (with the question mark), and hit return:
?IterativeSolver

Or enter this into the help-window's search field (without the question mark):
IterativeSolver

acer

Look here.

acer

Look here.

acer

What you need to know here is what is meant by the average value of a continuous function over a range.

For a discrete problem (eg. height of a finite number of people in a class) the average is usually taken to be the sum of their heights divided by the number of people.

So, for a continuous range of values (x values) how do you "add up" all the values? Isn't it by finding the area under the curve? And how do you "divide by the number of values"? Isn't it by dividing by the length of the range?

acer

What you need to know here is what is meant by the average value of a continuous function over a range.

For a discrete problem (eg. height of a finite number of people in a class) the average is usually taken to be the sum of their heights divided by the number of people.

So, for a continuous range of values (x values) how do you "add up" all the values? Isn't it by finding the area under the curve? And how do you "divide by the number of values"? Isn't it by dividing by the length of the range?

acer

You don't need `maximize` or `minimize` in order to find values of x where f becomes flat (ie. where the slope of f gets to zero).

> f := cos((1+sin(x))^(1/2));
                                                1/2
                           f := cos((1 + sin(x))   )

> df := diff(f,x);
                                               1/2
                               sin((1 + sin(x))   ) cos(x)
                    df := -1/2 ---------------------------
                                                 1/2
                                     (1 + sin(x))

Look df can only be zero when one of the two factors of the numerator of df is zero. By that I mean, only when either cos(x) is zero or sin((1+sin(x))^(1/2)) is zero. And any such special values must lie within 0..5, which is the range that you were given.

So, what value in 0..5 makes cos(x) to be zero?

Now look. sin(0) is 0, yes? So, if (1+sin(x))^(1/2) were zero then sin((1+sin(x))^(1/2)) would also be zero. And if 1+sin(x) were zero then (1+sin(x))^(1/2) would be zero. So what value of x in 0..5 makes 1+sin(x) be zero? What value of x in 0..5 makes sin(x) be -1 ?

But watch out! When (1+sin(x))^(1/2) is zero then the denominator of df will also be zero! And you may not just divide, 0/0. So check the limit, and the graph.

> eval(df,x=3*Pi/2);
Error, numeric exception: division by zero
> limit(df,x=3*Pi/2);
                                       0

plot( f, x=0..5 );

You see, you don't have to resort to the maximize() and minimize().

maximize( f, x=0..5, location );
minimize( f, x=0..5, location );

acer

You don't need `maximize` or `minimize` in order to find values of x where f becomes flat (ie. where the slope of f gets to zero).

> f := cos((1+sin(x))^(1/2));
                                                1/2
                           f := cos((1 + sin(x))   )

> df := diff(f,x);
                                               1/2
                               sin((1 + sin(x))   ) cos(x)
                    df := -1/2 ---------------------------
                                                 1/2
                                     (1 + sin(x))

Look df can only be zero when one of the two factors of the numerator of df is zero. By that I mean, only when either cos(x) is zero or sin((1+sin(x))^(1/2)) is zero. And any such special values must lie within 0..5, which is the range that you were given.

So, what value in 0..5 makes cos(x) to be zero?

Now look. sin(0) is 0, yes? So, if (1+sin(x))^(1/2) were zero then sin((1+sin(x))^(1/2)) would also be zero. And if 1+sin(x) were zero then (1+sin(x))^(1/2) would be zero. So what value of x in 0..5 makes 1+sin(x) be zero? What value of x in 0..5 makes sin(x) be -1 ?

But watch out! When (1+sin(x))^(1/2) is zero then the denominator of df will also be zero! And you may not just divide, 0/0. So check the limit, and the graph.

> eval(df,x=3*Pi/2);
Error, numeric exception: division by zero
> limit(df,x=3*Pi/2);
                                       0

plot( f, x=0..5 );

You see, you don't have to resort to the maximize() and minimize().

maximize( f, x=0..5, location );
minimize( f, x=0..5, location );

acer

First 543 544 545 546 547 548 549 Last Page 545 of 596