dharr

Dr. David Harrington

8445 Reputation

22 Badges

21 years, 29 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

It is a sum over the different roots. Perhaps there is an easier way, but here is one way to do it.

restart

S := proc (t) options operator, arrow; tanh(ln(1+t^2)) end proc

proc (t) options operator, arrow; tanh(ln(1+t^2)) end proc

q := diff(S(t), `$`(t, n))

pochhammer(1-n, n)+Sum(-(1/4)*_alpha^3*pochhammer(-n, n)*(t-_alpha)^(-1-n), _alpha = RootOf(_Z^4+2*_Z^2+2))

`assuming`([simplify(allvalues(q))], [n::posint])

(1/4)*GAMMA(n+1)*(-1)^n*((1+I)*(-1-I)^(1/2)*(t-(-1-I)^(1/2))^(-1-n)+(1-I)*(-1+I)^(1/2)*(t-(-1+I)^(1/2))^(-1-n)+(-1-I)*(-1-I)^(1/2)*(t+(-1-I)^(1/2))^(-1-n)+(-1+I)*(t+(-1+I)^(1/2))^(-1-n)*(-1+I)^(1/2))

``

Download simplify.mw

Your code contains the line

S2 := t -> piecewise(xn(t) <= xa and 0 < zn(t), -S1(t)*exp(mu1*alpha2(t)), 0)

which suggests that the drop-off might be when xn(t) or zn(t) becomes zero. Plotting xn(t) or equivalently, Xn, shows that Xn goes through zero at that point. So then fsolve(Xn, 0.2..0.9) returns the drop-off point of 0.5006805969.

min_problem.mw

Use Pi and not pi.

restart; with(LinearAlgebra)

w := c[i]*(1-cos(2*Pi*x/a))*(1-cos(2*Pi*y/b))

c[i]*(1-cos(2*Pi*x/a))*(1-cos(2*Pi*y/b))

al_eq1 := (1/2)*(int(int(D__11*(diff(w, x, x))^2+2*D__12*(diff(w, x, x))*(diff(w, y, y))+4*D__66*(diff(w, x, y))^2+D__22*(diff(w, y, y))^2-2*q__0*w, x = 0 .. a), y = 0 .. b))

c[i]*(6*D__11*Pi^4*b^5*c[i]+4*D__12*Pi^4*a^2*b^3*c[i]+6*D__22*Pi^4*a^4*b*c[i]+8*D__66*Pi^4*a^2*b^3*c[i]-a^4*b^5*q__0)/(a^3*b^4)

NULL

Download Pi.mw

A bit less efficient, perhaps.

[Edit: my interpretation of the OPs question was that different columns were to be scaled differently, but if rows were intended, then premultiplication by the diagonal matrix works.]

A:=Matrix(3,3,[1,6,9,7,4,3,2,8,9]);
B:=<a,b,c>;
A^~(-1).LinearAlgebra:-DiagonalMatrix(B);

Matrix(3, 3, {(1, 1) = 1, (1, 2) = 6, (1, 3) = 9, (2, 1) = 7, (2, 2) = 4, (2, 3) = 3, (3, 1) = 2, (3, 2) = 8, (3, 3) = 9})

Vector(3, {(1) = a, (2) = b, (3) = c})

Matrix(%id = 36893490033002534060)

``

Download div.mw

If I understand correctly what you want, a (Tabulated) DataFrame is one way to display this.

stiffnessmatrixcal.mw

Here's one way to do it, using custom tickmarks.

restart;

Frequency as a function of lambda

freq:=lam->2.9979/lam;

proc (lam) options operator, arrow; 2.9979/lam end proc

fmax:=0.3;

.3

lambda values for ticks

lams:=[10,15,20,40];
freqs:=map(freq,lams);

[10, 15, 20, 40]

[.2997900000, .1998600000, .1498950000, 0.7494750000e-1]

p1:=plot(x*(1-x),x=0..1,view=[default,0..fmax],labels=[x,f],axes=boxed):
p2:=plot(x*(1-x),x=0..1,view=[default,0..fmax],labels=[x,lambda],axes=boxed,axis[2]=[tickmarks=(freqs=~lams)]):
plots:-dualaxisplot(p1,p2);

NULL

Download dualaxes.mw

Suggest you upload your worksheet next time (green up arrow in the editor).

in
for n to N do

subs([seq(x(i) = x[c][i], i = 0 .. n),

the i in x[c][i] must be x[c][i+1] since list indices start at 1. Same for further on in the line. After fixing this there is another error arising because you have used "x" as a simple variable in the differentiation and other places as well as with x[c][i] - you need different names for these. 

There are various technical issues here that I'm going to ignore. What answer were you expecting? What do you want to happen for negative x? Is this a signal that is zero for x<0. If so, then you can just use laplace with s=I*omega

eval(laplace(f(x),x,s),s=I*omega);

gives
 1/2*Pi^(1/2)/(I*omega)^(3/2)

Well, this finds any of the polynomials. But what type of answer exactly is expected here?

restart

eq := (-x^2+x)^(4*n) = (x^2+1)*p+(-4)^n

(-x^2+x)^(4*n) = (x^2+1)*p+(-4)^n

p := solve(eq, p)

-((-4)^n-(-x^2+x)^(4*n))/(x^2+1)

p7 := normal(eval(p, n = 7), expanded)

x^54-28*x^53+377*x^52-3248*x^51+20098*x^50-95032*x^49+356642*x^48-1089008*x^47+2751463*x^46-5817892*x^45+10371647*x^44-15656288*x^43+20050108*x^42-21785872*x^41+20066492*x^40-15656288*x^39+10355263*x^38-5817892*x^37+2767847*x^36-1089008*x^35+340258*x^34-95032*x^33+36482*x^32-3248*x^31-16007*x^30-28*x^29+16385*x^28-16384*x^26+16384*x^24-16384*x^22+16384*x^20-16384*x^18+16384*x^16-16384*x^14+16384*x^12-16384*x^10+16384*x^8-16384*x^6+16384*x^4-16384*x^2+16384

NULL

Download polynomial.mw

use sol:-value(r=0..10,t=0..20) to get the values out. [Edit - not correct - see correct answer below] (It is helpful if you load your actual worksheet using the big green up-arrow in the Mapleprimes editor.)

The error is because C1 is zero. My recollection is that the calculation of the t-value involves dividing by the standard error, which is zero. Then the absolute value of infinity leads to the complex infinity.

You should scale your dependent data down to values within a few orders of magnitude of 1, say by dividing it by 10^7. Then your parameters will be 10^7 times higher and more reasonable. You are likely running into numerical accuracy issues because your problem is not better scaled. Actually you could use stronger scaling for the last column.

Here is a scaled version that works:

toycode3.mw

with(GraphTheory);
G := Multigraph(2, [{1, 2}, {1, 2}]);
DrawGraph(G);

The 2 by the edge in DrawGraph shows there are two edges between vertices 1 and 2.

You can have several worksheets open with the same Maple engine - See Tools->Options->General tab, and under Mathematical Engine choose "Share one engine among all documents".

Alternatively you can save variables with the save command, and then use the read command to retrieve them.

Conversion to arbitrary real base > 1. Adapted from  https://en.wikipedia.org/wiki/Non-integer_base_of_numeration

restart;

This version for each digit < "Z". Output is string. precision is number of digits after the point.

conv:=proc(number,base,precision::posint)
  local k,result,i,digit,n,b,q,alphabet,sign;
  alphabet:="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  n:=evalf(number);
  sign:=signum(n);
  if sign = 0 then return "0" end if;
  b:=evalf(base);
  if b<=1 then error "base must be >1" end if;
  if floor(b)>length(alphabet) then error "base too large for alphabet" end if;
  k := floor(log[b](sign*n)) + 1;
  Digits:=k+precision+5;
  n:=evalf(sign*number);
  b:=evalf(base);
  k := floor(log[b](n)) + 1;
  result := "";
  for i from k-1 by -1 while i > -precision-1 do
    q:=n/b^i;
    digit:=floor(q-b*floor(q/b));
    n:=n-digit*b^i;
    result:=cat(result,alphabet[digit+1]);
  end do;
  if k>0 then
    result:=cat(result[1..k],".",result[k+1..-1])
  else
    result:=cat("0.",StringTools:-Fill("0",-k),result)
  end if;
  if sign=1 then
    result
  else
    cat("-",result)
  end if;
end proc:

Examples

conv(exp(1), sqrt(5), 60);

"10.100012001101002001020001000120011120012010000011102001001111"

conv(-27, Pi, 60);

"-220.300202001222002022021123003002220111200220220010221021011111"

NULL

Download tobase.mw

In general there are many roots. An implicitplot will show curves where there are solutions. The algcurves packsge has more routines to analyse such curves.

restart

P := randpoly([x, y])

-92*x^3*y^2+6*x^2*y^3+74*x*y^4+23*x^4+75*x*y^3-50*x

plots:-implicitplot(P, x = -5 .. 5, y = -5 .. 5)

algcurves also show an isolated solution at the origin

algcurves:-plot_real_curve(P, x, y)

algcurves:-singularities(P, x, y); evalf(%)

{[[0, -RootOf(74*_Z^4-75*_Z^3-50), 1], 2, 1, 2]}

{[[0., -1.312413632, 1.], 2., 1., 2.]}

NULL

Download bivariate.mw

First 32 33 34 35 36 37 38 Last Page 34 of 83