Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

My guess is that it'll be very difficult to tell when this kind of coefficient blowup will occur, and even more difficult to tell whether isolate will work better than solve. So I think that what's needed is a way to "normalize" the coefficients after the blowup. My procedure balance below handles this. There're probably cases where it won't work, but this is the kind of thing that's used on an ad hoc basis.

 

Eq1:= (2*(.2916666667*Mtrailer+.5000000000*M1))*(diff(y1(t),t$2)) +
     MR*(.5*Mtrailer*g+M1*g)+Kspring*MR^2*y1(t)+Cd2*MR*(diff(y1(t),t)):

s:= solve(Eq1, diff(y1(t),t,t));

-2500000000.*MR*(2.*Kspring*MR*y1(t)+2.*Cd2*(diff(y1(t), t))+2.*M1*g+Mtrailer*g)/(2916666667.*Mtrailer+5000000000.*M1)

balance:= e-> (L-> `/`((L/~max((abs@lcoeff)~(L)))[]))([numer,denom](e)):

 

balance(s);

-.5000000000*MR*(2.*Kspring*MR*y1(t)+2.*Cd2*(diff(y1(t), t))+2.*M1*g+Mtrailer*g)/(.5833333334*Mtrailer+1.000000000*M1)

 

 

Download balance.mw

By the way, I corrected your Eq1: It had a "naked" y1 which I changed to y1(t).

How about 12 seconds? It's better than your current 32 seconds. Use this:

A:= ImportMatrix(
     "/Imp34462 14.txt",
     source= delimited, delimiter= ";", datatype= float[8]
):

eqn:= diff(y(t),t) = -.25*y(t):
init:= y(0) = 5:
sol:= dsolve({eqn, init}, {y(t)}, numeric):
p:= plots:-odeplot(sol, [t, y(t)], t= 0..50, colour = red):
A:= select(p-> p[2] > 1.5, convert(op([1,1], p), listlist));

Okay, I understand your polynomial-to-integer encoding scheme now. The command to extend an already-extended finite field is Primfield. So, in the worksheet below, I extract the root of your quadratic irreducible in GF(2^8) and give it a representation in GF(2^16). Then I get the other root in the new field.


How to re-extend a finite field with the Primfield command

Author: Carl J Love, 2015-Apr-15.

restart:

Define a field extension for GF(2^8) using an irreducible polynomial of degree 8.

ext1:= Z^8+Z^4+Z^3+Z+1:

Verify irreducibility:

Factors(ext1) mod 2;

[1, [[Z^8+Z^4+Z^3+Z+1, 1]]]

Coefficients in the new field are expressed as polynomials in abstract roots of the extending polynomial expressed via the RootOf function. We wish to write and to see this root as a simple variable rather than as a complicated RootOf function, so we use alias.

alias(x= RootOf(ext1)):

We will extract the eigenvalues of the below matrix in this field, and then construct a splitting field to get the remaining eigenvalues.

M:= < 1,     x,             1,           x^2;
      x^2,   x^3+1,         x^2+x,       x^4+1;
      x^4+1, x^5+x^2+x,     x^4+x^3,     x^6+x;
      x^6+x, x^7+x^4+x^2+1, x^6+x^5+x^2, x^3+x+1 >:

C:= Charpoly(M,t) mod 2;

t^4+(x^3+x+1+x^4)*t^3+t^2+x^4*t+1

The field's elements can be compactly represented as integers by a natural binary encoding scheme. This is for our viewing purposes only; it is not used for computation.

encode:= p-> eval(p, x= 2):

encode(C);

t^4+27*t^3+t^2+16*t+1

CF:= Factors(C) mod 2;

[1, [[x^7+x^6+x^4+x^3+t+1, 1], [x^5+x^2+t+1, 1], [x^7*t+x^6*t+x^5*t+x^4+x^3+x^2*t+x^2+x*t+t^2+x+t, 1]]]

encode(CF);

[1, [[217+t, 1], [37+t, 1], [t^2+231*t+30, 1]]]

So we have two eigenvalues in our field (represented as 217 and 37 in the encoding scheme), and two more that are roots of the irreducible quadratic.

 

Extract the nonlinear irreducible parts (this command works even if there is more than one irreducible factor):

irr:= map(collect, select(q-> degree(q,t) > 1, map2(op,1,CF[2])), t);

[t^2+(x^7+x^6+x^5+x^2+x+1)*t+x^4+x^3+x^2+x]

eval(irr, x= 2);

[t^2+231*t+30]

q:= irr[1]:

Now construct the splitting field that contains q's roots.

alias(z= RootOf(q)):

PF:= Primfield({x,z}) mod 2:

Extract the new degree 16 field extension:

ext2:= (indets(PF, 'RootOf'(anything)) minus {x,z})[];

RootOf(_Z^16+_Z^13+_Z^10+_Z^9+_Z^2+_Z+1)

Note that ext2 is a randomly chosen irreducible (mod 2) polynomial of degree 16. If you execute the Primfield command again, you may get a different polynomial. The important thing is how the old field's entries are expressed in the new field. All these relationships are stored in PF. We compactify the visual representation of the relationships with a new alias.

alias(y= ext2):

PF;

[[y = z^15+z^14+z^11+z^10+z^7+z^5+z^3], [z = y^15+y^14+y^13+y^11+y^10+y^9+y^8+y^7+y^6+y^5+y^3+y^2+1, x = y^10+y^9+y^8+y^5+y]]

The first equation is not of much use to us here. One of the others expresses one of the roots of q,which we named z, in the new field. The other expresses the old field extension x in terms of the new, y.

newx:= eval(x, PF[2]);

y^10+y^9+y^8+y^5+y

Now re-express q in the new field.

eval(q, x= newx);

t^2+((y^10+y^9+y^8+y^5+y)^7+(y^10+y^9+y^8+y^5+y)^6+(y^10+y^9+y^8+y^5+y)^5+(y^10+y^9+y^8+y^5+y)^2+y^10+y^9+y^8+y^5+y+1)*t+(y^10+y^9+y^8+y^5+y)^4+(y^10+y^9+y^8+y^5+y)^3+(y^10+y^9+y^8+y^5+y)^2+y^10+y^9+y^8+y^5+y

Now get both roots:

Rq:= Roots(%) mod 2;

[[y^15+y^11+y^10+y^9+y^7+y^4+y^3+y^2+y+1, 1], [y^15+y^14+y^13+y^11+y^10+y^9+y^8+y^7+y^6+y^5+y^3+y^2+1, 1]]

We can see that one of the roots is, of course, the z. Now verify that the second root is the first one raised to the 2^8 power:

Expand(eval(z, PF[2])^(2^8)) mod 2;

y^15+y^11+y^10+y^9+y^7+y^4+y^3+y^2+y+1

 


Download Primfield.mw

You have given minimal information, so I can only give a minimal Answer. To evaluate an expression ex at x=17 do

eval(ex, x= 17);

If you need more help than that, you must post your code.

In Maple, the mathematical constant Pi is spelled with a capital P. If you spell it pi, it is treated as just another variable.

Hmm, I think that you mean a nine-game round of a competition, not a nine-team. How can there be nine games in the first round if there are nine teams? Anyway, here's a one-line procedure for it. The parameter n is the number of games. So, the matrix that you specifically asked for is T(9).

T:= n-> Matrix((op~)~(combinat:-permute([[1,0]$n,[0,1]$n], n)))^%T;

Note that every even-numbered row of the matrix is redundant: It is the exact opposite of the row above it.

I feel that the Answer by Markiyan and the comment by Tom have brought an unnecessary cloud of negativity over this situation. Yet it can be easily and simply solved by Maple when solutions exist.

Here's a worksheet with a procedure for the eigenvalues and a procedure for an associated eigenvector to each eigenvalue. I do an example over a field with a prime number of elements and one over a field with a prime power number of elements.


Eigenvalues and Eigenvectors over finite fields

 

In this worksheet, I present two simple procedures: One gives the eigenvalues of a matrix over a finite field, and the other returns an eigenvector given an eigenvalue.

`mod/Eigenvalues`:= proc(M::Matrix(square), p::posint)
     local x;
     Roots(Charpoly(M, x) mod p) mod p
end proc:

`mod/Eigenvector`:= proc(M::Matrix(square), lambda, p::posint)
#Returns an eigenvector of M associated with the eigenvalue lambda.
uses LA= LinearAlgebra;
local
     n:= op([1,1], M),
     rank, t,
     sol:= Linsolve(M - lambda*LA:-IdentityMatrix(n), Vector([0$n]), rank, t) mod p
;
     if rank=n then
          error "Second argument must be an eigenvalue of the first."
     end if;
     eval(sol, indets(sol, specindex(posint,t))[]= 1)
end proc:
     

Examples of use: First we do a field with a prime number of elements. Note that in the case of finite fields, there is a possibility that there are no eigenvalues.

p:= 13:

M:= LinearAlgebra:-RandomMatrix(10):

eig:= Eigenvalues(M) mod p;

[[9, 1]]

(1)

The eigenvalues are returned paired with their multiplicity.

 

Now get the eigenvector associated with the first eigenvalue.

if eig<>[] then Eigenvector(M, eig[1,1]) mod p end if;

Vector(10, {(1) = 2, (2) = 3, (3) = 1, (4) = 11, (5) = 5, (6) = 10, (7) = 10, (8) = 8, (9) = 10, (10) = 1})

(2)

Now an example over a finite field with a non-prime number of elements: GF(2,2).

alias(alpha= RootOf(x^2+x+1)):

R:= rand(1..4):

GF4:= [0,1,alpha,alpha+1]:

M:= Matrix(5, 5, (i,j)-> GF4[R()]);

M := Matrix(5, 5, {(1, 1) = alpha, (1, 2) = alpha+1, (1, 3) = 1, (1, 4) = 0, (1, 5) = alpha, (2, 1) = 0, (2, 2) = 0, (2, 3) = 1, (2, 4) = alpha+1, (2, 5) = alpha+1, (3, 1) = alpha+1, (3, 2) = 0, (3, 3) = alpha+1, (3, 4) = 1, (3, 5) = alpha, (4, 1) = alpha+1, (4, 2) = 1, (4, 3) = 1, (4, 4) = alpha, (4, 5) = 1, (5, 1) = 1, (5, 2) = alpha, (5, 3) = alpha+1, (5, 4) = 1, (5, 5) = 0})

(3)

Eigenvalues(M) mod 2;

[[0, 1], [alpha+1, 2]]

(4)

Eigenvector(M, 0) mod 2;

Vector(5, {(1) = 1, (2) = 0, (3) = 0, (4) = 1, (5) = 1})

(5)

Eigenvector(M, alpha+1) mod 2;

Vector(5, {(1) = 0, (2) = alpha+1, (3) = 0, (4) = alpha, (5) = 1})

(6)

 


Download finite_field_eigenvalues.mw

The issue is exactly as Tom Leslie suggests in his fourth point: The lack of spacing in the expression P[B](p-w) causes Maple to interpret it as a function, P[B], whose argument is p-w. You no doubt intended for P[B] to be a coefficient to p-w. To express that multiplication, you need either a space or an explicit multiplication symbol between the two: either P[B] (p-w) or P[B]*(p-w).

This is only an issue when using Maple's odious 2D-input. In 1D-input, both f(x) and f (x) represent function application, and multiplication always requires an explicit symbol. I suggest switching to 1D-input.

The notation D(P[B])(p-w) means the derivative of the unknown (but known to be univariate) function P[B] evaluated at p-w.

I suspect that what you created was a table, not a list. I'd be able to tell instantly if I saw your code. So, try

display(convert(plotlist, list));

I suspect that you did something like the below, which creates a table, not a list:

for k to 5 do
     plotlist[k]:= plot(x^k, x= 0..1)
end do:

There's nothing wrong with the above code; indeed, one of the best ways to make a list is to first make a table and then convert it to list.

Yes, I can confirm it. To workaround, include the option linestyle= solid. This is also required if you want to see the wireframe or grid or mesh lines of surface plots.

Your input has been mangled horribly by Maple's 2D-input. In particular, most of your function applications have been misinterpretted as multiplications. For example, x(t) has been changed to x*t in several places. This is probably because you entered x (t) rather then x(t). I suggest that you use the 1D-input: Go to the Tools menu, select Options, then the Display tab. From the Input display pull-down, select Maple notation. Then select the Interface tab. From the "Default format for new worksheets" pull-down, select Worksheet. Then click on Apply Globally. Then open a new worksheet and retype your program.

Do you mean that you want the abcissa to be the circumference of a circle of radius R?

R:= 5:
plot(
     [
          [cos(t)*(cos(7*t)+R), sin(t)*(cos(7*t)+R), t= 0..2*Pi],
          [R*cos(t), R*sin(t), t= 0..2*Pi]
     ],
     color= [red, black], axes= none
);

plot3d([cos(t)*sin(p), sin(t)*sin(p), cos(p)], t= 0..2*Pi, p= 0..Pi);

You wrote:

I have another question: ... how could I find the values of root on vertical axis? In this figure I want to know the value of F(0) that cut the vertical axis?

Simply enter F(0), or in this case K(0), and you'll get the answer, 1. How is it possible that you are working with Kummer and Heun functions, and yet you don't know this basic math? It's called the y-intercept.

First 265 266 267 268 269 270 271 Last Page 267 of 395