dharr

Dr. David Harrington

8205 Reputation

22 Badges

20 years, 336 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are answers submitted by dharr

If I start from Eq. 12,  and pdsolve in a loop, then it is fairly easy to reproduce this result (pdsolving the whole system didn't seem to work).


 

restart;

eq[0]:=diff(V[0](x,t),t)=0;
ic[0]:=V[0](x,0)=1+cosh(2*x);
ans[0]:=pdsolve({eq[0],ic[0]},V[0](x,t));

diff(V[0](x, t), t) = 0

V[0](x, 0) = 1+cosh(2*x)

V[0](x, t) = 1+cosh(2*x)

n:=5;

5

for i to n do
  eq[i]:=diff(V[i](x,t),t)+I*diff(V[i-1](x,t),x,x)=0;
  ic[i]:=V[i](x,0)=0;
  ans[i]:=pdsolve(eval({eq[i],ic[i]},ans[i-1]),V[i](x,t));
end do:

uu:=collect(add(rhs(ans[i]),i=0..n),t);

1+cosh(2*x)-(4*I)*cosh(2*x)*t-8*cosh(2*x)*t^2+((32/3)*I)*cosh(2*x)*t^3+(32/3)*cosh(2*x)*t^4-((128/15)*I)*cosh(2*x)*t^5

[seq(coeff(uu,t,i),i=0..degree(uu,t))];
gfun:-guessgf(%,t)[1];

[1+cosh(2*x), -(4*I)*cosh(2*x), -8*cosh(2*x), ((32/3)*I)*cosh(2*x), (32/3)*cosh(2*x), -((128/15)*I)*cosh(2*x)]

1+exp(-(4*I)*t)*cosh(2*x)

 


 

Download HPM.mw

assign(solution) will do it.

use the option explicit=true after the set of variables.


 

plot(cos(q),q=0..4*Pi,labels=["",""],axis[1]=[tickmarks=[2*Pi=2*Pi/omega,4*Pi=4*Pi/omega]],axis[2]=[tickmarks=[-1=-R,1=R]]);

 


(No, really, it looks right in the worksheet.)

Download costicks.mw

Plotting to look is always a first step.
 

restart;

eq:=(-69/50)*sin((32/25)*x)=(4/5)*exp((-23/50)*x);

-(69/50)*sin((32/25)*x) = (4/5)*exp(-(23/50)*x)

plot([lhs(eq),rhs(eq)],x=0..10);

 

Looks to be between 2 and 4.

Download hint.mw

fsolve is a numerical solver and Digits controls accuracy... Good luck.

You need the two equations in a set (or list), you had a Y instead of y, and the derivatives as entered weren't right, as can be seen by converting to 1-D input. Here is the worksheet with the right syntax (please check). dsolve ran for about 3 ks in Maple 2017 before I gave up, so in your later version you may (eventually) get a solution.

Ric_Eqns.mw

 

I added some explicit multiplications, so hope that gives what is intended.

Gc := (s^2*t^2+2*s*t*x+1)*(-b*s+1)/(k*(-b*s+1)*s*(t*c+b));

(s^2*t^2+2*s*t*x+1)/(k*s*(c*t+b))

expand(convert(Gc,parfrac,s));

t^2*s/(k*(c*t+b))+2*t*x/(k*(c*t+b))+1/(k*s*(c*t+b))

 

 


 

Download parfrac.mw

To change the default behaviour, set:

_EnvUseHeavisideAsUnitStep := true;

(see the help page for Heaviside)

Or just make a piecewise function

MyStep:=x->piecewise(x<0,0,0<=x,1);

I don't see a problem here - my interpretation is that seq returns the default value without accessing ("scanning") the entry in the rtable, just as V[6] returns 0.

I think the following logic works for mod 2 as well are regular matrices. We want to test all nonsingular matrices without too much duplication. Below shows that we need only test all perturbation matrices (n! of them) plus an extra 1 (n^2-n possibilities) and another extra 1 (n^2-n-1 possibilities). This is possible in about an hour on my laptop. If produces many duplicates and I show only one answer. It would be possible to eliminate duplicates with a bit more effort.

Of the 8 columns, none have only zeros so six of then have one 1 and two have two 1s. For the six columns with one 1, there will be two row positions, say i and j that have no 1s for any of the six columns. Now consider the 7th column, with two 1s.

If neither of these two 1s are in row i or j then this column is a sum of two of the six columns and so the matrix would be singular. So the 7th column has one or two 1's in row i or j. If it has only one, say in i, then for the 8th column there must be a 1 in row j, otherwise row j would be zero and the matrix would be singular. In this case, every column has a 1 in a different row (a permutation matrix) and there are two extras.

If the 1s in column 7 are in row i and j, then consider column 8. If its two 1s avoided row i and j, it would be a sum of the six columns. So it must have one 1 in i or j. Then column 7 has a 1 in the other or i or j and again we have a perturbation matrix with two extra 1s.

The following tests this.

restart;

with(LinearAlgebra[Modular]):with(Iterator):

n:=8; #s = n+2
f:=x^8+x^7+x^5+x+1;#f:=x^8+x^4+x^3+x^2+1;
perms:=Permute(n):
Number(perms)*(n^2-n)*(n^2-n-1); # matrices to check

8

x^8+x^7+x^5+x+1

124185600

st:=time():
p:=0:          # count matrices checked
nsucc:=0:      # count matrices with correct char. poly.
succ:=table(): # collect succesful ones
for perm in perms do
  A:=Create(2,n,n,integer[]):
  for i to n  do
    A[perm[i],i]:=1:
  end do:
  for k to n^2 do
    if A(k)=1 then next else A(k):=1 end if;
    for m to n^2 do
      if A(m)=1 then next else A(m):=1 end if;
      p:=p+1;
      #if p mod 10000000 =0 then print(p,(time()-st)/60*min) end if;
      if CharacteristicPolynomial(2,A,x)=f then nsucc:=nsucc+1; succ[nsucc]:=copy(A) end if;
      A(m):=0;
    end do;
    A(k):=0;
  end do;
end do:
print(p,`matrices tested.`,nsucc,`successes.`,`cpu time:`,(time()-st)/60*min);

124185600, `matrices tested.`, 80640, `successes.`, `cpu time:`, 67.80286667*min

B:=succ[1];add(B);CharacteristicPolynomial(2,B,x);

_rtable[18446744628225754526]

10

x^8+x^7+x^5+x+1

 


 

Download Modular5.mw

Edit: improved with modifications suggested by @vv :

Modular6.mw

A bit contrived but this does it:


 

A:=[1,2,3,4,5,6];
B:=[10,20,30,40,50,60];

[1, 2, 3, 4, 5, 6]

[10, 20, 30, 40, 50, 60]

plots:-display(seq(plot([A[i],y,y=0..B[i]],color=blue),i=1..numelems(A)),view=[0..6,DEFAULT],thickness=3);

 


 

Download plots.mw

[Edit: see improved answer below]

Still takes a long time for 8x8 so I didn't wait. Below is just a different approach, FYI.
 

restart;

with(LinearAlgebra[Modular]):with(Iterator):

n:=4;s:=3;
f:=x^4+x;
perms:=Permute([1$s,0$(n^2-s)]):
Number(perms);

4

3

x^4+x

560

st:=time():i:=0:
for perm in perms do
 i:=i+1;
 lst:=convert(perm[],list);
 A:=Matrix(n,n,lst);
 cp:=CharacteristicPolynomial(2,A,x);
 if cp=f then print(time()-st,A,cp) end if;
end do:
i;
time()-st;

.281, Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 1, (3, 1) = 0, (3, 2) = 1, (3, 3) = 0, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 1, (4, 4) = 0}), x^4+x

.328, Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 1, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 1, (4, 1) = 0, (4, 2) = 1, (4, 3) = 0, (4, 4) = 0}), x^4+x

.375, Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 1, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 1, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 1, (4, 4) = 0}), x^4+x

.406, Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 1, (2, 1) = 1, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 0, (4, 2) = 1, (4, 3) = 0, (4, 4) = 0}), x^4+x

.484, Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 1, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 1, (4, 1) = 1, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0}), x^4+x

.547, Matrix(4, 4, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 1, (1, 4) = 0, (2, 1) = 1, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 0, (3, 2) = 1, (3, 3) = 0, (3, 4) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0}), x^4+x

.578, Matrix(4, 4, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 0, (1, 4) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 1, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 1, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0}), x^4+x

.640, Matrix(%id = 18446744237432444678), x^4+x

560

.703

 


 

Download Modular2.mw

Edit: since you wanted nonsingular I should have chosen x^4+x+1 (degree 4 without zero root) and s=4 (>=4 or there will be a zero row/column)

Edit: OP has changed algorithm so above is no longer comparable.

I think you will have to give some ranges for the variables to make any progress here. These can probably be quite wide, e.g., 0..infinity if you know a parameter is positive and don't wan't to be too restrictive.

This is the first order approximation that @Mac Dude alludes to, with the details to get the standard errors out:
 

Download Parameters.mw

This goes partly there - need to collect the a's and convert to the equivalen binomial

convert((a+b)^n,FormalPowerSeries,b) assuming n::posint;
convert(%,binomial);

Sum(a^n*(-1/a)^k*pochhammer(-n, k)*b^k/factorial(k), k = 0 .. infinity)

Sum(a^n*(-1/a)^k*binomial(-n+k-1, -n-1)*b^k, k = 0 .. infinity)

 

 


 

Download binomial.mw

First 64 65 66 67 68 69 70 Last Page 66 of 81