acer

32348 Reputation

29 Badges

19 years, 329 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

It works for me in Maple 18.02.  (I corrected the obvious syntax mistake 2*x instead of 2x .)

Consider uploading a worksheet that demonstrates the problem.

If you are using 2D Input mode then don't paste code in as plaintext here if it's not valid 1D Maple Notation. Otherwise it's confusing. Uploading a worksheet is key if your problem is 2D Input specific.

Please upload the worksheet.

Do you understand that the expression is not zero for all real phi?

@Nicogbruun In 2D Input mode you'll need to put round brackets around a negative angle, to allow it to parse. That works for me in the latest version I had.

For me, entering `&angle;`(17,-45) in plaintext 1D Input mode shows it right for me. In 2D Input then foo := 17 <anglethingy> (-45) displays -17 <angethingy> 135 as output, although all later printing of foo shows it nicer with the -45, and argument(foo) returns -Pi/4.

If you have an input example with a negative angle that still doesn't work (with extra round brackets around the angle) then please upload the worksheet/document in a further Reply.

The auto-execute Warning is because it's in Start-up code of the worksheet/document. You can turn that off as a GUI setting. From the main menubar go to Tools->Options->Interface , and then the box titled Confirmation Dialogs , and then toggle off the checkbox Autoexecute disabled.  I'll take this as a reminder that I was going to put this into a "package" and upload to the Cloud. That too would get rid of such a warning. I have to finish the Help page.

@miroslav In Maple 18.02 doing a Help search for gamma pulls up the Help page for GAMMA, but the page for initialconstants (gamma) is the second item down in the Search Results pane.

In Maple 2018 doing a Help search for gamma opens the initialconstants (gamma) page directly.

@PhilipKroon You should not assign to f(x). There are very special and rare circumstances where it's useful but based on your description so far that is almost certainly not your situation. You are bound to run into trouble if you do so.

As an example, do it this way instead (with a and b as numeric values):

f := x^2;  plot(f, x=a..b);

Here is how you can evaluate an expression at a particular value for x,

f := x^2;
                                  2
                            f := x 

eval(f, x=3.1);
                              9.61

And here is how you can turn an existing expression (involving the name x) into a procedure. You can then call the procedure at a particular point.

f := x^2;
                                  2
                            f := x 

f_func := unapply(f, x);
                                       2
                       f_func := x -> x 

f_func(3.1);
                              9.61

 

It looks like you have accidentally entered the literal name log__10 (double underscore) instead of the indexed name log[10] .

Both of those display in typeset 2D Output as a subscripted name. But the former means nothing to Maple, and does not compute any logarithm.

A small visual cue is that the literal subscripted name gets its subscript displayed in italics, which the indexed 10 is displayed in upright Roman font.

If you have trouble with 2D Input you could consider switching to 1D (plaintext) Maple Notation for input, which can be set up as a GUI preference.

There is also log10 which is an alternate for log[10] but without the subscripting in the name.

@Christopher2222 When you write, "I was meaning the fine structure constant value is represented by other constants..." you are mixing it up and getting it backwards. As I said, the fine structure constant is not a derived constant in the ScientificConstants package. It is not "represented" in terms of other constants. But some other constants can be derived from it.

It would be wrong to have a derive equation entry returned from GetConstant for a non-derived constant, as that would be misleading.

These constants are can be derived directly from alpha using the derive equation returned by GetConstant.

restart;

 

L := ScientificConstants:-GetConstants(':-derivedfrom'=alpha);

a[0], e, m[e], mu[B], r[e]

for r in [L] do
  form:=eval(':-derive',
             select(type,[ScientificConstants:-GetConstant(r)],`=`));
  if form<>'form' then
    print(r=eval(form,`if`(T::table,convert(T,list),[])));
  end if;
end do:

a[0] = (1/4)*alpha/(Pi*R[infinity])

e = 2^(1/2)*(alpha*h/(mu[0]*c))^(1/2)

m[e] = 2*R[infinity]*h/(c*alpha^2)

mu[B] = (1/32)*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)/(Pi*R[infinity])

r[e] = alpha^2*a[0]

 

Download getforms1.mw

And some other constants can, in turn, be derived from those above.

Because the derivations are not cyclic we can drill down.

restart;

F:=proc(nm::name,T)
  local L, r, form;
  uses ScientificConstants;
  L:=[GetConstants(':-derivedfrom'=nm)];
  for r in L do
    if not assigned(T[r]) then
      form:=eval(':-derive',select(type,[GetConstant(r)],`=`));
      if form<>'form' then
        T[r]:=r=eval(form,`if`(T::table,convert(T,list),[]));
        procname(r,T);
      end if;
    end if;
  end do;
  NULL;
end proc:

T:='T':
F(alpha,T);
for f in [entries(T)] do
  print(f);
end do;

[a[0] = (1/4)*alpha/(Pi*R[infinity])]

[k = 2*R*R[infinity]*h/(`A[r](e)`*M[u]*c*alpha^2)]

[sigma = (4/15)*Pi^2*R^4*R[infinity]^4*h^4/(`A[r](e)`^4*M[u]^4*c^6*alpha^8*hbar^3)]

[mu[B] = (1/32)*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)/(Pi*R[infinity])]

[N[A] = (1/2)*`A[r](e)`*M[u]*c*alpha^2/(R[infinity]*h)]

[e = 2^(1/2)*(alpha*h/(mu[0]*c))^(1/2)]

[m[alpha] = 2*R[infinity]*h*`A[r](alpha)`/(c*alpha^2*`A[r](e)`)]

[mu[mu] = -(1/32)*`m[e]/m[mu]`*(1+a[mu])*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)/(Pi*R[infinity])]

[lambda[C, mu] = (1/2)*alpha^2*`m[e]/m[mu]`/R[infinity]]

[m[d] = 2*R[infinity]*h*`A[r](d)`/(c*alpha^2*`A[r](e)`)]

[g[n] = 2*mu[n]*32^(1/2)*Pi*R[infinity]*`A[r](p)`/((c*alpha^5*h/mu[0])^(1/2)*`A[r](e)`)]

[mu_prime[p] = -(1/32)*(1+a[e])*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)/(`mu[e]/mu_prime[p]`*Pi*R[infinity])]

[gamma[p] = -(1/16)*(1+a[e])*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)/(`mu[e]/mu[p]`*Pi*R[infinity]*hbar)]

[mu[n] = -(1/32)*`mu[n]/mu_prime[p]`*(1+a[e])*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)/(`mu[e]/mu_prime[p]`*Pi*R[infinity])]

[r[e] = (1/4)*alpha^3/(Pi*R[infinity])]

[m[e] = 2*R[infinity]*h/(c*alpha^2)]

[R[K] = (1/2)*mu[0]*c/alpha]

[b = .1007026176*c^2*`A[r](e)`*M[u]*alpha^2/(R*R[infinity])]

[lambda[C, n] = (1/2)*alpha^2*`A[r](e)`/(R[infinity]*`A[r](n)`)]

[m[h] = 2*R[infinity]*h*`A[r](h)`/(c*alpha^2*`A[r](e)`)]

[gamma[e] = (1/16)*32^(1/2)*(abs(alpha)^5*abs(c*h/mu[0]))^(1/2)*abs((1+a[e])/R[infinity])/(Pi*hbar)]

[mu[p] = -(1/32)*(1+a[e])*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)/(`mu[e]/mu[p]`*Pi*R[infinity])]

[m[n] = 2*R[infinity]*h*`A[r](n)`/(c*alpha^2*`A[r](e)`)]

[G[0] = 4*alpha/(mu[0]*c)]

[gamma_prime[h] = (1/16)*32^(1/2)*(abs(alpha)^5*abs(c*h/mu[0]))^(1/2)*abs(`mu_prime[h]/mu_prime[p]`*(1+a[e])/(`mu[e]/mu_prime[p]`*R[infinity]))/(Pi*hbar)]

[mu_prime[h] = -(1/32)*`mu_prime[h]/mu_prime[p]`*(1+a[e])*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)/(`mu[e]/mu_prime[p]`*Pi*R[infinity])]

[K[J] = 2*2^(1/2)*(alpha*h/(mu[0]*c))^(1/2)/h]

[m[p] = 2*R[infinity]*h*`A[r](p)`/(c*alpha^2*`A[r](e)`)]

[sigma[e] = (1/6)*alpha^6/(Pi*R[infinity]^2)]

[F = N[A]*2^(1/2)*(alpha*h/(mu[0]*c))^(1/2)]

[mu[N] = (1/32)*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)*`A[r](e)`/(Pi*R[infinity]*`A[r](p)`)]

[mu[d] = -(1/32)*`mu[d]/mu[e]`*(1+a[e])*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)/(Pi*R[infinity])]

[c[2] = (1/2)*c^2*`A[r](e)`*M[u]*alpha^2/(R*R[infinity])]

[gamma_prime[p] = -(1/16)*(1+a[e])*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)/(`mu[e]/mu_prime[p]`*Pi*R[infinity]*hbar)]

[lambda[C] = (1/2)*alpha^2/R[infinity]]

[lambda[C, tau] = (1/2000000)*h*2^(1/2)*c/(`m[tau]c^2`*(alpha*h/(mu[0]*c))^(1/2))]

[m[mu] = 2*R[infinity]*h/(c*alpha^2*`m[e]/m[mu]`)]

[Phi[0] = (1/4)*h*2^(1/2)/(alpha*h/(mu[0]*c))^(1/2)]

[m[tau] = 1000000*`m[tau]c^2`*2^(1/2)*(alpha*h/(mu[0]*c))^(1/2)/c^2]

[gamma[n] = (1/16)*32^(1/2)*(abs(alpha)^5*abs(c*h/mu[0]))^(1/2)*abs(`mu[n]/mu_prime[p]`*(1+a[e])/(`mu[e]/mu_prime[p]`*R[infinity]))/(Pi*hbar)]

[lambda[C, p] = (1/2)*alpha^2*`A[r](e)`/(R[infinity]*`A[r](p)`)]

[m[u] = 2*R[infinity]*h/(`A[r](e)`*c*alpha^2)]

[g[p] = 2*mu[p]*32^(1/2)*Pi*R[infinity]*`A[r](p)`/((c*alpha^5*h/mu[0])^(1/2)*`A[r](e)`)]

[mu[e] = -(1/32)*(1+a[e])*32^(1/2)*(c*alpha^5*h/mu[0])^(1/2)/(Pi*R[infinity])]

 

Download getforms.mw

@brian bovril Sorry, I may have inadvertantly messed with the underlying link. Hopefully fixed now.

Stripped, text input is this:

restart;
ans:=numapprox:-minimax(LambertW(x),x=0.3..30.0,[4,2],1,'maxerror'):
maxerror;
ans:=subs(1.000000000=1.0,
          evalf(subsindets(ans,float,u->u/coeff(numer(ans),x,0)))):
lprint(ans);
plot(abs(LambertW(x)-ans)/LambertW(x),x=0.3..30.0,
     size=[600,200],gridlines=false);
restart;
ans:=numapprox:-minimax(LambertW(x),x=0.3..30.0,[3,2],1,'maxerror'):
maxerror;
ans:=subs(1.000000000=1.0,
          evalf(subsindets(ans,float,u->u/coeff(numer(ans),x,0)))):
lprint(ans);
plot(abs(LambertW(x)-ans)/LambertW(x),x=0.3..30.0,
     size=[600,200],gridlines=false);

@Carl Love No surprise to me that you and I were likely typing almost the exact same suggestion about eval at almost the exact same time. I'll let my edit, which was submitted a few minutes after yours, stand if that's OK. I live in hope that one day robust/defensive coding might win through.

By increasing the degree of numerator and denomiator in the call to minimax (eg, [4,2] say) you can get it yet more accurate.

For the range in question you can rescale numerator and denominator by the constant term of the numerator, to get it shorter.

lambertw_minimax_2.mw

@brian bovril FWIW, the absolute error of this W exceeds 0.001 for at least all x in [7,30], and the relative error exceeds 0.001 for at least all x in [10,30].

Do you have a finite range, only over which for which LambertW need be computed? If so then can you say how accurate you need the results over that range?

There are several techniques by which a function can be approximated accurately over a given finite range. The numapprox package provides a few such techniques.

I don't claim that the following is anything like a "best" approximation, but it wasn't hard to construct and since it's just a rational polynomial it should evaluate very quickly. For example, accurate within 1e-6 from x=0.0 to x=100.0 if computed under double-precision:

piecewise(x < .4, 0.198394191883251e-6+(.999988637665485+(-.999701379608006+(1.49522869051649+
(-2.61487938008756+(4.80375526286693+(-8.44292903760859+(12.8240767341281+(-15.0087206308243+
(11.6147616375837-4.36133692656942*x)*x)*x)*x)*x)*x)*x)*x)*x)*x, (0.1216e-10+(0.289973981e-7+
(0.5312526019e-7+(0.25344660140e-7+(0.4125772676500e-8+(0.252429913806814e-9+
(0.589135044083757e-11+(0.488016160494293e-13+(0.111452607599594e-15+(0.145364040477580e-19
-0.456882364309766e-23*x)*x)*x)*x)*x)*x)*x)*x)*x)*x)/(0.29118186807e-7+(0.81652561972e-7+
(0.6534480793030e-7+(0.18879666618791e-7+(0.214476447880656e-8+(0.98645561776089e-10+
(0.179712113556884e-11+(0.117132012126034e-13+0.201072533564079e-16*x)*x)*x)*x)*x)*x)*x)*x))

lambertw_approx.mw

@qilianshan The simple answer is "No, Maple does not currently have point-probe functionality in 3D plots."

@jamalator You've now written "8695*y ~ = 1341*y".  Why has it changed, and what do you mean by it?

What is your actual question? Please use full and grammatical sentences. Please completely and accurately describe your goal.

First 239 240 241 242 243 244 245 Last Page 241 of 592