Carl Love

Carl Love

28055 Reputation

25 Badges

12 years, 358 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

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);

remove(t-> degree(t,x)=1, poly);

Use plot3d instead of implicitplot. You just need to take the lhs of your equations (equivalent to getting rid of the "=0" part). Note from the plot that there are vast regions of the b-c plane where the floating-point evaluation of your functions is 0. Now reduce the view. Redo the plot3d with option view= [-200..200, -200..200, -1..1]. The piecewise-linear nature of the plots leads me to believe that the numerical evaluation of your expressions is highly suspect, and thus the results of both implicitplot and DirectSearch (or any other numerical solver) are worthless.

See command fprintf. This lets you print exactly what you want to a file.

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