Carl Love

Carl Love

28070 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

I think that the only difference between the "versions" of Maple is the price. I am sure that all of those implement the algorithm via the IntegerRelations:-PSLQ command.

Your L1 is a (one-dimensional) Array of lists, each list being a pair of numbers. The same for L2. So [L1,L2] is a list of Arrays of lists. Apparently, that's too much mixing of types for plot to understand. You need to either convert everything to listlist form, or make L1 and L2 into two-dimensional Arrays (or Matrices). To do the former,

plot(map(convert, [L1,L2], listlist));

To do the latter, don't use zip to create L1 and L2. Rather, use Matrix constructors. The following assumes that groups is an Array:

L1:= < groups^%T | waitArray[..,1] >:   L2:= < groups^%T | waitArray[..,2] >:

If groups is a column vector, then omit the ^%T. If groups is a list, then

L1:= < < groups[] > | waitArray[..,1] >:  L2:= < < groups[] > | waitArray[..,2] >:

The action of the angle bracket operators is controlled by the very simple procedures `<,>` and `<|>`. In this case only the former matters. Look at showstat(`<,>`). Since lists are not scalars, and since there is more than one argument, the code branches to the line

Matrix([[args]], scan= columns);

When the left side of an assignment can only be referenced by its membership in a container, you need to use the assign command rather than the assignment operator :=. So, change your last section of code to

for i from 1 to Dimension(Q) do
     for j from 2 to nops(Q[i]) do
          assign(Q[i][j], Q[i][1])
     end do
end do:

I also changed nops(Q) to nops(Q[i]). The former makes no sense whatsoever.

You can use unassign:

unassign('a1', 'a2', 'a3', 'a4');

Note that the quotes are required.

To do it more systematically,

unassign(map(evaln, '[a||(1..4)]')[]);

The command to read .m files is simply read:

read "MyFile.m";

If you want to know the names of the new procedures defined from the file, you could do this:

before:= {anames(procedure)}:
read "MyFile.m":
newprocs:= {anames(procedure)} minus before;

The coefficient of x^k is given by

C:= (n,k)-> binomial(n,k)*2^k:

For fixed n, C(n,k) is a unimodal function of k for 0 <= k <= n. We want n such that the maximum on this range is at k=8.

fsolve({eval(diff(C(n,k),k), k=8)}, n= 8..infinity);

Since we need an integer solution, it's either n=11 or n=12, or possibly both.

seq(C(11,k), k= 7..9);

seq(C(12,k), k= 7..9);

So the answer is n = 12.

 

1. Option discont:

To correctly plot a function with discontinuities, use option discont in the plot command:

plot(tan(x), discont);

To set this permanently, include the following line in your initialization file:

local plot:= proc({discont:= true}) :-plot(args, ':-discont'= discont) end proc:

 

2. Unevaluation quotes:

To prevent the evaluation of functions, enclose the function name in single quotes, like

y = 'sin'(x - Pi/2);

 

3. Required semicolons:

I haven't been able to duplicate what you say. For me, they all require semicolons. Regardless, you should get in the habit of ending all statements with a colon or a semicolon. The colon would be used to suppress output.

 

4. MaplePrimes new users' section.

The majority of Questions on MaplePrimes are asked by new Maple users. However, most of those questions are asked by users with more mathematical experience than you.

I suggest that you check the units of time in your problem. Are you consistently using the same time unit? The 3600 makes me suspicious.

The equation can be easily proven to have no positive real solution. The integrand is

and the interval of integration is 0..70. For dd > 0, this function is positive and has a unique maximum at t = 17. That maximum is 870. It follows that the maximum possible value of the integral is 870*70 = 60900. This is not even close to your value of V ~ 5.7e7. But if you take out the 3600, then the equation makes sense.

I have never seen this phenomenon before, but apparently the complex option to fsolve is required in this case even though the returned answer is real. So just change the last command to

fsolve(eq, dd, complex);

and it will return almost immediately with the result

(I use Digits = 15.)

I hope that someone else can comment on this phenomenon.

The equation has two real solutions in the complex domain. One of those solutions is -1-sqrt(2). If you plug this in for x in the original equation, you get a negative under the square root sign. That's not allowed in RealDomain. If you want those solutions, don't use RealDomain.

Build each frame of the animation with display, then put those frames in sequence. Like this:

display([seq(display([A[g],B[g]]), g= 1..G)], insequence= true);

To leave a space without printing the quote marks, use back quotes ` `. This is the character under the Escape on most US keyboards. It's also called accent grave. It has ASCII value 96. These quote marks do not appear in the pretty-printed output.

A conversion to algebraic normal form is available in the Logic package; it just goes by a different name: MOD2. It is part of command Canonicalize as option form= MOD2.

Logic:-Canonicalize(&not a, form= MOD2);

Logic:-Canonicalize(a &or b, form= MOD2);

In this form, XOR is represented by +, and AND is represented by juxtaposition/multiplication.

 

A command to plot the quadratic is

plot(x^2+2, x= -2..2);

There is no need to specify a y-range. However, note that the y-axis of the plot starts at 2, not 0. If you want it to start at 0, then you need to specify the y-range:

plot(x^2+2, x= -2..2, y= 0..6);

First 301 302 303 304 305 306 307 Last Page 303 of 395