Carl Love

Carl Love

28100 Reputation

25 Badges

13 years, 106 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

To attach a file using the MaplePrimes editor, use the green uparrow, which is the last tool on the second row of the toolbar.

@k20057 5 Why do you allow [1, 1, 1, 4, 1, 1] under the Fermi-Dirac model? Shouldn't it be forbidden because more than two particles have one unit of energy?

@acer How do you create a PlotComponent and name it Plot0?

@k20057 5 But I did not remove any of the functionality of the original code! I only added functionality. If you want a Bose-Einstein sample of size 100,000, it is done like this:


restart:

QuantumDistribution:= proc(
     n::nonnegint, #Number of quanta of energy
     k::posint,    #Number of particles
     {model::identical("Bose-Einstein","Maxwell-Boltzmann","Fermi-Dirac"):= NULL},
     {output::identical(exact, sampler, population):= exact}
)
local C, Population, sz, Rand;
     if model = "Maxwell-Boltzmann" then
          Population:= combinat:-composition(n+k, k)
     else
          # Bose-Einstein:
          Population:= select(p-> nops(p)=k, combinat:-partition(n+k, n+1));
          if model = "Fermi-Dirac" then
               Population:= select(C-> ListTools:-FindRepetitions(C,2) = [], Population)
          end if
     end if;
     sz:= nops(Population);
     userinfo(1, QuantumDistribution, NoName, "Population size = ", sz);
     Population:= [seq(C-~1, C= Population)];
     if output = 'exact' then

          (lhs=rhs/sz)~([{Statistics:-Tally(op~(Population))[]}[]])
     elif output = 'sampler' then
          Rand:= rand(1..sz);
          ()-> Population[Rand()]
     else
          # output = 'population'
          Population
     end if
end proc:

R:= QuantumDistribution(9, 6, model= "Bose-Einstein", output= sampler):

n:= 10^5: #Sample size

S:= ['R()' $ n]:

T:= [{map(lhs=rhs/n, Statistics:-Tally(op~(S)))[]}[]]:

Decimal versions of sampled values:

ES:= evalf(%);

[0. = 2.26359000000000, 1. = 1.54463000000000, 2. = .882690000000000, 3. = .538230000000000, 4. = .309940000000000, 5. = .194810000000000, 6. = .114910000000000, 7. = 0.754900000000000e-1, 8. = 0.377900000000000e-1, 9. = 0.379200000000000e-1]

 


Download QuantumDistribution.mw

 

Please upload your file as a Maple worksheet (extension .mw), not as a .doc file.

@Markiyan Hirnyk 

It is obvious that Preben did not intend for his code to be executed in isolation but rather using the OP's definition of unitcircle. If you do it that it way then it runs fine.

@H-R Thank you. You now have enough reputation to vote.

@H-R Yes, the operand numbers of a function never change. In f(a,b), the f is operand 0, a is operand 1, and b is operand 2. For nonassociative infix operators that only take two operands (=, <=, <, >, >=, .., ::, ^), operand 1 is always the left side.

So, if the left side of BC4 will always be the sum (and only the sum), then op([1,1], BC4) will safely extract the operand of the sum. This operand is a product (of type `*`). The select command will select factors of that product based on a boolean condition. The condition is that the factor has a subexpression of type sinh(algebraic), which means the function sinh applied to any single type algebraic argument. See ?select , ?hastype , ?type,algebraic , ?type,structure .

Please supply the code for function f. If I change your f to something simple like 1, then I do not get white lines.

Do the white lines appear on the plot in the worksheet? Or do they only appear after you've transferred the plot somewhere else?

The order of terms in some expressions such as polynomials is not fixed in Maple. However, if you apply the sort command to a polynomial, then the order (and hence the operand numbers) are definite.

For a more detailed analysis of your situation, please post your code in plaintext form or as an attached worksheet.

When I enter your code like this, I have no problem.

Vp:= [bF*F*(1-F/kF)+mu*FI,
     bv1*V1*(1-V1/kV1),
     bv2*V2*(1-V2/kV2), 0, 0, 0];

VectorCalculus:-Jacobian(Vp, [FS, V1S, V2S, FI, VII, V2I]);

But there must have been some preliminary code that you had. Otherwise the Jacobian is trivial because your expression Vp doesn't contain the variables FS, V1S, V2S, VII, or V2I.

So, please post your complete code in plaintext form or as an attached worksheet so that I don't have to retype it.

Please post the code that generates the Matrix. At first glance it looks like the problem is possibly that you are using lists instead of Vectors or Matrices.

@Markiyan Hirnyk Okay, yes, I converted the general formulas for slope and tangent line from Cartesian to polar. But I did not use Cartesian coordinates in the way that the OP objected to: I did not convert anything from polar to rectangular, and I plotted the line in polar.

The OP wrote:

How can I avoid having to convert everyting to rectangular coords, and plot the tangent line in polars?

 

The first answer that Maple gave you is not really wrong. It is an indeterminate form: 0*infinity. That just means that it will take more work to get the answer. Using combine or another simplifier is the best thing you could do.

@Markiyan Hirnyk Do you doubt that that's the tangent line in vector form? T[2] is equivalent to the OP's expression for the tangent line.

First 529 530 531 532 533 534 535 Last Page 531 of 709