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

ColumnRelations:= proc(M::Matrix, {free::symbol:= :-_v})
uses LA= LinearAlgebra;
local k;
     evalc(map2(`.`, <seq(free[k], k= 1..op([1,2], M))>, LA:-NullSpace(M))) =~ 0
end proc:

ColumnRelations(M, free= v);

If the output in your worksheet can be regenerated quickly, then you should remove the output before saving it. You can use the menu selection Edit -> Remove output -> From worksheet.

Yes, you should consider dividing your worksheet. When the GUI gets bogged down, as often happens with lengthy output, there's no equivalent of the Stop button that will stop it. I've often had to kill the GUI, which kills the whole Maple process.

The worksheet below has the complete answers to your three questions, using a slightly different technique than Kitonum (very slightly different). I only post it because I was composing it at the same time that he was composing his.

restart:

l1 := [1, 1, 1, 0, 0, 0, 0, 0, 0]:

l2 := [0, 0, 0, 1, 1, 1, 0, 0, 0]:

l3 := [0, 0, 0, 0, 0, 0, 1, 1, 1]:

l4 := [1, 0, 0, 1, 0, 0, 1, 0, 0]:

l5 := [0, 1, 0, 0, 1, 0, 0, 1, 0]:

l6 := [0, 0, 1, 0, 0, 1, 0, 0, 1]:

l7 := [0, 0, 1, 0, 1, 0, 1, 0, 0]:

 

A:= Matrix([l||(1..7)]):

b:= Vector(7, fill= 15):

 

Answer for your first question:

Sol:= LinearAlgebra:-LinearSolve(A, b, free= t);

Sol := Vector(9, {(1) = -30+2*t[8]+3*t[9]+2*t[6], (2) = 30-2*t[8]-2*t[9]-t[6], (3) = 15-t[9]-t[6], (4) = 30-t[8]-2*t[9]-2*t[6], (5) = -15+t[8]+2*t[9]+t[6], (6) = t[6], (7) = 15-t[8]-t[9], (8) = t[8], (9) = t[9]})

(1)

The free variables are:

Free:= [indets(Sol, name)[]];

[t[6], t[8], t[9]]

(2)

 

Answer for your third question:

Sol:= convert(Sol, list):
S:= {$0..8}:
n:= nops(Free):
Sols:= table():
for T in combinat:-permute([S[]], n) do
     A:= Free =~ T;
     if {eval(Sol, A)[]} = S then Sols[A]:= [][] end if
end do:
{
indices(Sols, nolist)};

{}

(3)

Nothing is in the set, so the answer to your third question is "No".

 

Answer for your second question:

S:= {$2..8}:
Sols:= table():
for T in combinat:-permute(`$`~([S[]], n), n) do
     A:= Free =~ T;
     if {eval(Sol, A)[]} = S then Sols[A]:= [][] end if
end do:
indices(Sols, nolist);

[t[6] = 2, t[8] = 4, t[9] = 7], [t[6] = 6, t[8] = 4, t[9] = 4], [t[6] = 3, t[8] = 2, t[9] = 8], [t[6] = 6, t[8] = 7, t[9] = 4], [t[6] = 4, t[8] = 8, t[9] = 4], [t[6] = 8, t[8] = 4, t[9] = 4], [t[6] = 7, t[8] = 6, t[9] = 4], [t[6] = 8, t[8] = 6, t[9] = 3], [t[6] = 6, t[8] = 2, t[9] = 6], [t[6] = 2, t[8] = 3, t[9] = 8], [t[6] = 2, t[8] = 6, t[9] = 6], [t[6] = 7, t[8] = 8, t[9] = 2], [t[6] = 3, t[8] = 4, t[9] = 6], [t[6] = 4, t[8] = 2, t[9] = 7], [t[6] = 6, t[8] = 8, t[9] = 2], [t[6] = 8, t[8] = 6, t[9] = 2], [t[6] = 8, t[8] = 7, t[9] = 2], [t[6] = 6, t[8] = 4, t[9] = 6], [t[6] = 4, t[8] = 3, t[9] = 6], [t[6] = 4, t[8] = 6, t[9] = 6], [t[6] = 4, t[8] = 2, t[9] = 8], [t[6] = 4, t[8] = 6, t[9] = 4], [t[6] = 2, t[8] = 4, t[9] = 8], [t[6] = 6, t[8] = 8, t[9] = 3]

(4)

So the answer to your second question is "Yes", and the above are all the possibilities.

 

 

Download zero-one_system.mw

Assuming that the input is floating point, the command that you want is frem(..., evalf(2*Pi)). If your input contains symbolic Pi that you'd like to keep in the output, let me know.

Here's a procedure that does what you want:

YourProc:= proc(
     fx::algebraic,
     `x= a..b`::And(name=range(realcons), satisfies(r-> op([2,1], r) < op([2,2], r))),
     n::posint,
     {functionoptions::list({symbol, name= anything}):= []},
     {pointoptions::list({symbol, name= anything}):= []}
)
local
     x:= op(1, `x= a..b`),
     a:= op([2,1], `x= a..b`),
     r:= op([2,2], `x= a..b`) - a,   #b-a
     Df:= unapply(diff(fx, x), x),
     k,   #index
     xs:= [seq(a+k*r/n, k= 0..n)]
;
     plots:-display(
          plot(fx, `x= a..b`, functionoptions[]),
          plot([seq([k, Df(k)], k= xs)], style= point, pointoptions[]),
          _rest
     )
end proc:

And an example of its use:

YourProc(
     x^2, x= -2..2, 5,
     functionoptions= [color= green],
     pointoptions= [symbol= cross, symbolsize= 24],
     axes= boxed
);

The last three arguments are optional. You could just as well use it as

YourProc(x^2, x= -2..2, 5);

Note that intervals in Maple are specified as 2..5 rather than [2,5]. However, if you insist on using [a,b], I can easily change the procedure to accomodate that.

As a workaround, you can use Maple Input (aka 1D input).

The direct cause of your problem is that you're not allowed to assign to a parameter, in this case M. You can make a local copy of M like this:

M1:= copy(M);

Then make all assignments to M1 and return M1.

There are also a few places where you used = that should've been :=.

You should begin your procedure with 

uses LinearAlgebra;

or

uses LA= LinearAlgebra;

Don't rely on the with statement being active in your procedure---sometimes it may be, sometimes it may not be.

Suppose that your dsolve result is assigned to ans:

ans:= dsolve(...);

Then do

u:= unapply(eval(u(t), ans), t);

If g=0, then f can be arbitrary and the jacobian will still be zero. That's why the fourth solution shows f unchanged.

plot3d([r, theta, Pi/6], theta= 0..2*Pi, r= 0..1, coords= spherical);

Acer's Answer is very complete. Here's a quick-and-dirty version that works in any Maple GUI. Define two procedures to be used as binary operators:

`&<`:= (a,b)-> a*exp(I*b*Pi/180):

`&+`:= proc(a,b)
local x,y;
     (x,y):= op(evalf(polar(a+b)));
     '`&<`'(x, evalf(y*180/Pi))
end proc:

Now,

(5 &< 30) &+ (4 &< 60);

Your matrix is only Hermitian if all the variables are real. If you do substitute real values for the variables, then the imaginary parts of those two eigenvalues will be zero. Is it possible to prove, in general, that those imaginary parts are real (other than by saying that the eigenvalues came from a Hermitian matrix)? I doubt it. It's well known that there are real algebraic numbers that can't be expressed in radical form without using imaginary numbers. For example, consider the roots of x^3 - 3*x + 1.

In the worksheet below, I approximate your infinite sum using an asymptotic series for BesselJ. I just did the sum itself; I ignored the constant multipliers that you have in front of the sum.

I'm not totally confident of the mathematical validity of what I did. In particular, I have some skepticism about simplifying an asymptotic series under the assumption that the variable is integer. Hopefully, someone else can comment.

P.S.: Independent computation in later Replies confirms the accuracy of this approach, although it turns out that there's a much easier way.

restart:

kernelopts(version);

`Maple 16.02, X86 64 WINDOWS, Nov 18 2012, Build ID 788210`

(1)

Digits:= 15:


I will attempt to evaluate the following infinite sum via an asymptotic expansion.

S:= Sum(BesselJ(0,(2*n-1)*Pi/4)^2/(2*n-1), n= 1..infinity);

Sum(BesselJ(0, (1/4)*(2*n-1)*Pi)^2/(2*n-1), n = 1 .. infinity)

(2)

Maple refuses to do either symbolic or numeric evaluation.

value(S);

sum(BesselJ(0, (1/4)*(2*n-1)*Pi)^2/(2*n-1), n = 1 .. infinity)

(3)

evalf(S);

Sum(BesselJ(0, (1/4)*(2*n-1)*Pi)^2/(2*n-1), n = 1 .. infinity)

(4)

Extract the summand, which we'll use several times:

F:= unapply(op(1,S), n);

proc (n) options operator, arrow; BesselJ(0, (1/4)*(2*n-1)*Pi)^2/(2*n-1) end proc

(5)

Check that the sum converges using its asymptotic expansion.

A:= convert(asympt(F(n), n, 5), polynom);

2*sin((1/4)*(2*n-1)*Pi+(1/4)*Pi)^2/(Pi^2*n^2)+(2*sin((1/4)*(2*n-1)*Pi+(1/4)*Pi)*((1/2)*sin((1/4)*(2*n-1)*Pi+(1/4)*Pi)/Pi-(1/2)*cos((1/4)*(2*n-1)*Pi+(1/4)*Pi)/Pi^2)/Pi+sin((1/2)*Pi*n)^2/Pi^2)/n^3+(2*sin((1/4)*(2*n-1)*Pi+(1/4)*Pi)*(-(3/8)*cos((1/4)*(2*n-1)*Pi+(1/4)*Pi)/Pi^2+(-(9/16)/Pi^3+(3/16)/Pi)*sin((1/4)*(2*n-1)*Pi+(1/4)*Pi))/Pi+(1/2)*((1/2)*sin((1/4)*(2*n-1)*Pi+(1/4)*Pi)/Pi-(1/2)*cos((1/4)*(2*n-1)*Pi+(1/4)*Pi)/Pi^2)^2+(1/2)*sin((1/2)*Pi*n)*(2*sin((1/2)*Pi*n)*Pi-cos((1/2)*Pi*n))/Pi^3)/n^4

(6)

It's clear that the sum converges absolutely. Let's see graphically how well the terms of the series are approximated by these first two terms. First note that the terms will simplify significantly if we assume that n is an even or odd integer.

Ev:= simplify(A) assuming n::even;

(1/8)/(Pi^4*n^4)

(7)

Od:= expand(simplify(A) assuming n::odd);

2/(Pi^2*n^2)+2/(Pi^2*n^3)-(9/8)/(Pi^4*n^4)+(3/2)/(Pi^2*n^4)

(8)

A1:= eval(Od, n= 2*n-1) + eval(Ev, n= 2*n);

2/(Pi^2*(2*n-1)^2)+2/(Pi^2*(2*n-1)^3)-(9/8)/(Pi^4*(2*n-1)^4)+(3/2)/(Pi^2*(2*n-1)^4)+(1/128)/(Pi^4*n^4)

(9)

plots:-display(
     plot([eval(Od, n= 2*n-1), eval(Ev, n= 2*n)], n= 10..50, color= [blue,aquamarine]),
     plot([seq([[n, F(2*n-1)], [n, F(2*n)]][], n= 10..50)], style= point),
     axes= boxed
);

 

We see very good agreement. Now, extend that idea, using more terms of the asymptotic series.

A:= convert(asympt(F(n), n, 5), polynom):


Get the next several terms so that we can estimate the truncation error.

AT:= convert(asympt(F(n), n, 9), polynom) - A:

Ev:= simplify(A) assuming n::even:

Od:= simplify(A) assuming n::odd:

FS:= eval(Od, n= 2*n-1) + eval(Ev, n= 2*n):

BesselSum:= (N::even)->
     add(evalf(F(n)), n= 1..N) +
     evalf(Sum(FS, n= N/2+1..infinity)
):

BesselSum(2^10);

.785852250894058

(10)

Estimate the truncation error:

EvT:= simplify(AT) assuming n::even:

OdT:= simplify(AT) assuming n::odd:

evalf(Sum(eval(OdT, n= 2*n-1) + eval(EvT, n= 2*n), n= 2^9+1..infinity));

0.918747449713164e-14

(11)

 

Download Bessel_infinite_sum.mw

In Maple, Pi is with a capital P.

I can't conceive of any message-encoding application where you wouldn't want the same number of bits in each byte. You can get the same number with the bits option to Split:

message:= `67A`:
bitP:= Bits:-Split~(convert(message, bytes), bits= 8);

Then the total number of bits is simply

8*nops(bitP);

     24

If you insist on using a variable number of bits per byte, the total number of bits can be counted as

bitP:= Bits:-Split~(convert(message, bytes));

`+`(nops~(bitP)[]);

19

First 229 230 231 232 233 234 235 Last Page 231 of 395