mmcdara

6331 Reputation

17 Badges

7 years, 349 days

MaplePrimes Activity


These are replies submitted by mmcdara

@acer 

I feel it could be more efficient as it avoids using Explode (?)

restart
A := {12, 17, 24, 28}:
B := {358, 568}:
TA:=table([map(a -> a=convert(a, base, 10), A)[]]):
TB:=table([map(b -> b=convert(b, base, 10), B)[]]):

{seq(seq(`if`(ormap(member,TA[a],TB[b]),
              NULL,parse(cat(a,b))),b=B),a=A)};

           {12358, 12568, 17358, 17568, 24358, 24568}

@pallav 

expr1 := 4*(theta - 1/4)*gamma1^2:
# The representation you required:
#                     2
# (4 theta - 1) gamma1 
simplify(expr1)
                                         2
                     (4 theta - 1) gamma1 



expr2 := (alpha + gamma1)^2*epsilon^2 + 2*(alpha + gamma1)*(beta + gamma1)*epsilon - 4*alpha*gamma1*theta + beta^2 + 2*beta*gamma1 - 4*(theta - 1/4)*gamma1^2:
# The representation you required:
#                                           2
# (beta + (alpha + gamma1) epsilon + gamma1)  - 4 gamma1 theta (alpha + gamma1)
Student:-Precalculus:-CompleteSquare(expr2, beta):
op(1, %) + factor(simplify(%-op(1, %)));
                                                    2
          (beta + (alpha + gamma1) epsilon + gamma1)   - 4 gamma1 theta (alpha + gamma1)

solutions.mw

@cq 

Thanks for your return.
Feel free to ask for more help.

@dharr 

Infinitely more clever than what I did.
I vote up.

For the record my first code was the one I sent in my reply.
But then I focused on the name Zeckendorf and I wonder myself "how could I modify my code to give the Zeckendorf's combination?" and this is the code I attached in my answer. ... but this obviously ended up in an unnecessary complex stuff.
 

@JAMET 

If you want ALL THE COMBINATIONS, there is no need to evoke the Zeckendorf's Theorem unless to look smart.

restart

GeneratorsOf := proc(n)
  local N, F, G, s:

  uses combinat:

  N := 1:
  while fibonacci(N) < n do N := N+1 end do: N := max(6, N-1):

  F := {seq(fibonacci(i), i=2..N)};
  G := convert(convert~(powerset(F) minus {{}}, list), list):
  s := select((g -> add(g)=n), G);
end proc:
  
  

GeneratorsOf(2);

[[2]]

(1)

GeneratorsOf(3);

[[3], [1, 2]]

(2)

GeneratorsOf(10);

[[2, 8], [2, 3, 5]]

(3)

GeneratorsOf(100)

[[3, 8, 89], [1, 2, 8, 89], [3, 8, 34, 55], [1, 2, 3, 5, 89], [1, 2, 8, 34, 55], [3, 8, 13, 21, 55], [1, 2, 3, 5, 34, 55], [1, 2, 8, 13, 21, 55], [1, 2, 3, 5, 13, 21, 55]]

(4)
 

 

Download fib_all.mw

Something I systematically observe is: if you edit your previous reply/answer within which you inserted the content of a worksheet and want to upload the content of a corrected/modified version of this same worksheet, the uploading time can take several dozens of seconds (but uploading the link alone is immediate).
Strangely starting by uploading the link and next the content is very fast.

Other observation: as for your using preview before submit seems to slowen dramatically the submission process (italic seems because this doesnt look as a systematic issue).

@Dkunb

In the fike attached to my answer, formula (8) is the sum of two terms each involving thr hypergeom function.
One of them contains

hypergeom([1, -m+1+min(m, n), -n+1+min(m, n)], [2+min(m, n)], 1/(2*a^2))

This function is multiplied a term of the form

something*binomial(m, min(m, n)+1)*binomial(n, min(m, n)+1)

Let us focus on the product P(m, n) of the two binomial functions.

P(m, n) = 0 for every couple (m, n) of integers.

Then the only contributor to formula (8) is the term

something*hypergeom([-m, -n], [], 1/(2*a^2))

... and this contributor doesn't contain any term involving min(m, n).

So, if you look to expression (7) in the file I attached to my answer, you clearly see that the sum goes from 0 to min(m, n).
The evaluation of this sum (relation  (8) ) also contains the function min(m, n) (which also appears in the "LaguerreL" expression you give in your question).
But at the very end  min(m, n) disappears because binomial(m, min(m, n)+1)*binomial(n, min(m, n)+1) is always null.

This disappearance explain why the final result (equation (10) ) is that simple.

@Preben Alsholm 

Thank you Preben

PS; I like your "You don't need the assumption at the end, but it doesn't hurt."

@NIMA112I have corrected you document (Maple 2015 worksheet).
Please check it out and get back to me:

restart

U := proc (x, t) options operator, arrow; U0*exp(I*omega*t)*cos(m*Pi*x/L) end proc; -1; W := proc (x, t) options operator, arrow; W0*exp(I*omega*t)*sin(m*Pi*x/L) end proc; -1; Upsilon := proc (x, t) options operator, arrow; Upsilon0*exp(I*omega*t)*cos(m*Pi*x/L) end proc

proc (x, t) options operator, arrow; Upsilon0*exp(I*omega*t)*cos(m*Pi*x/L) end proc

(1)

m := 1; -1; nu := .38; -1; h := 10*l; -1; l := 17.6*10^(-6); -1; mu := E/(2*(1+nu)); -1; E := 1.44*10^9; -1; rho := 1220; -1; L := 10*h; -1; R := 10^10

10000000000

(2)

``

Phi := proc (z) options operator, arrow; z*(1-(4/3)*z^2/h^2) end proc

proc (z) options operator, arrow; z*(1-(4/3)*z^2/h^2) end proc

(3)

G := E/(2*(1+nu));

521739130.4

(4)

Q[11] := E/(-nu^2+1);
Q[55] := G:


([Q[110], Q[111], Q[112]] =~ Q[11] *~ int~([1, z, z^2], z=-h/2..h/2))[];
assign(%);

1683029453.

 

Q[110] = 296213.1837, Q[111] = 0., Q[112] = 0.7646249650e-3

(5)

([Q[113], Q[114], Q[115]] =~ Q[11] *~ int~([Phi(z), Phi(z)^2, z*Phi(z)], z=-h/2..h/2))[];
assign(%);

Q[113] = 0., Q[114] = 0.4951856917e-3, Q[115] = 0.6116999719e-3

(6)

([Q[550], Q[551], Q[552]] =~ (Q[55]/Q[11]) *~ [Q[110], Q[111], Q[112]])[];
assign(%);

Q[550] = 91826.08695, Q[551] = 0., Q[552] = 0.2370337392e-3

(7)

([Q[553], Q[554], Q[555]] =~ (Q[55]/Q[11]) *~ [Q[113], Q[114], Q[115]])[];
assign(%);

Q[553] = 0., Q[554] = 0.1535075644e-3, Q[555] = 0.1896269913e-3

(8)

([Q[556], Q[557], Q[558], Q[559]] =~ Q[55] *~ int~([diff(Phi(z), z), z*diff(Phi(z), z), Phi(z)*diff(Phi(z), z), diff(Phi(z), z)^2], z=-h/2..h/2))[];
assign(%);

Q[556] = 61217.39128, Q[557] = 0., Q[558] = 0., Q[559] = 48973.91304

(9)

# check
eval(Q)

table( [( 11 ) = 1683029453., ( 55 ) = 521739130.4, ( 111 ) = 0., ( 550 ) = 91826.08695, ( 110 ) = 296213.1837, ( 551 ) = 0., ( 557 ) = 0., ( 556 ) = 61217.39128, ( 559 ) = 48973.91304, ( 558 ) = 0., ( 553 ) = 0., ( 552 ) = 0.2370337392e-3, ( 555 ) = 0.1896269913e-3, ( 554 ) = 0.1535075644e-3, ( 114 ) = 0.4951856917e-3, ( 115 ) = 0.6116999719e-3, ( 112 ) = 0.7646249650e-3, ( 113 ) = 0. ] )

(10)

terms := [1, z, z^2, Phi(z), Phi(z)^2, z*Phi(z), diff(Phi(z), z), z*diff(Phi(z), z), Phi(z)*diff(Phi(z), z), diff(Phi(z), z)^2, diff(Phi(z), z$2), diff(Phi(z), z$2)*diff(Phi(z), z), diff(Phi(z), z$2)^2]:

seq(beta[k] = mu*int(terms[k], z=-h/2..h/2), k=1..nops(terms));
assign(%);

beta[1] = 91826.08697, beta[2] = 0., beta[3] = 0.2370337392e-3, beta[4] = 0., beta[5] = 0.1535075644e-3, beta[6] = 0.1896269913e-3, beta[7] = 61217.39129, beta[8] = 0., beta[9] = 0., beta[10] = 48973.91305, beta[11] = 0., beta[12] = 0., beta[13] = 0.1581027668e14

(11)

# check
eval(beta)

table( [( 1 ) = 91826.08697, ( 2 ) = 0., ( 3 ) = 0.2370337392e-3, ( 4 ) = 0., ( 5 ) = 0.1535075644e-3, ( 6 ) = 0.1896269913e-3, ( 7 ) = 61217.39129, ( 9 ) = 0., ( 8 ) = 0., ( 11 ) = 0., ( 10 ) = 48973.91305, ( 13 ) = 0.1581027668e14, ( 12 ) = 0. ] )

(12)

N__T := 0; H__x := 0; N__0 := 0; K__2 := 0; K__1 := 0; DD := 0

0

 

0

 

0

 

0

 

0

 

0

(13)

local I:

seq(I[k-1] = rho*int(terms[k], z=-h/2..h/2), k=1..6);
assign(%);

I

 

Warning, The imaginary unit, I, has been renamed _I

 

I[0] = .2147200000, I[1] = 0., I[2] = 0.5542638934e-9, I[3] = 0., I[4] = 0.3589518548e-9, I[5] = 0.4434111146e-9

(14)

eq1 := - Q[110] * diff(U(x, t), x, x)
       + Q[111] * diff(W(x, t), x, x, x)
       - Q[113] * diff(Upsilon(x, t), x, x)
       - Q[110] * diff(W(x, t), x)/R
       - Q[556] * Upsilon(x, t)/R
       + Q[550] * U(x, t)/R^2
       - Q[551] * diff(W(x, t), x)/R^2
       + Q[553] * Upsilon(x,t)/(R^2)

       + (beta[1]*l^2)/(4*R)  * diff(W(x,t), x, x, x)
       - (beta[7]*l^2)/(8*R)  * diff(Upsilon(x,t), x, x)
       - (beta[1]*l^2)/(8*R^2)* diff(U(x,t), x, x)
       + (beta[2]*l^2)/(8*R^2)* diff(W(x,t), x, x, x)
       - (beta[4]*l^2)/(8*R^2)* diff(Upsilon(x,t), x, x)

       + I[0] * diff(U(x,t), t, t)
       - I[1] * diff(W(x,t), t, t, x)
       + I[3] * diff(Upsilon(x,t), t, t)

0.9437974374e12*U0*exp(I*omega*t)*cos(1784.995826*x)-0.5287797395e-1*W0*exp(I*omega*t)*cos(1784.995826*x)-0.6120983889e-5*Upsilon0*exp(I*omega*t)*cos(1784.995826*x)-.2147200000*U0*omega^2*exp(I*omega*t)*cos(1784.995826*x)

(15)

 

Download CHECK_THIS_mmcdara.mw

@MaPal93 

What I've done is tailored to your initial problem and I've never claimed that it's a generic method for dealing with other problems.
It is quite easy to ask for the solution of some problem and say this solution doen't work for another problem.
I suggest you think carefully about the problem, or category of problems, you want to solve and Reply here with more precise specifications.

@MaPal93 

Screen capture + conversion to png to be uploaded:

Direct export to png from the interactive graphic menu 

There is no blurring here.

I use Maple 2015.2 but I don't think it is a version issue. If you cannot solve this problem by your own I suggest you to open a new thread and join my code, yours, and the images above: someone would likely have an idea of what happens on your side.

@MaPal93 

For your functions f__1 and f__2, a simple solve is enough to find the locus o couples (sigma_-d, sigma__v) which verify f__1=f__2.

"For a more complex case ..." means essentially "whan solve is not enough". 
Then implicitplot(....) or contourplot(..., contours=[0]) may be good alternatives.

"A minor follow-up: why is the plot significantly blurred ..." there is no such thing in the worksheet.
As a rule the quality of the plots is significantly altered when displayed on Mapleprimes

@Carl Love 

Thanks Carl for this extremely detailed answer which seems to cover all my questions.
I'm not going to pretend I understood it in its entirety on the first sight, and I think a second (third?) reading will be necessary for me to get the right idea.

@Axel Vogt 

Thnk you Axel, this really helps.

@jalal 

Let's say we have some sample S, for instance S := Statistics:-Sample(Normal(0, 1), 10^3).
What is it that does not suit you in the command Statistics:-Histogram(S, opts), where opts is any sequence of options described in the help page?

Here are a few examples of histograms of samples drawn from a continuous or discrete random variable.
The last example is the histogram of the table you provided in your original question.

restart:

with(Statistics):


Histogram of a sample from a continuous random variable.

S := Sample(Uniform(-5, 5), 10^3):

h0 := Histogram(S):
h1 := Histogram(S, style=polygon):
h2 := Histogram(S, maxbins=10):
h3 := Histogram(S, frequencyscale=absolute):
h4 := Histogram(S, binbounds=[seq(-5+k, k=0..10)]):
h5 := Histogram(S, frequencyscale=absolute, transparency=0.8, color=red):

plots:-display(Matrix(2, 3, [seq(h||k, k=0..5)])):


Histogram of a sample from a discrete random variable.

S := Sample(DiscreteUniform(-5, 5), 10^3):


h0 := Histogram(S):
h1 := Histogram(S, discrete=true):
h2 := Histogram(
        S
        , discrete=true
        , axis[1]=[tickmarks=[$(-5..5)]]
        , thickness=20
        , style=polygon
        , view=[-5.5..5.5, default]
      ):

plots:-display(Matrix(1, 3, [h0, h1, h2])):


Histogram of  your sample.

data :=[ [[50, 60], 20], [[60, 70], 25], [[70, 80], 15], [[80, 90], 30], [[90, 100], 10] ]

[[[50, 60], 20], [[60, 70], 25], [[70, 80], 15], [[80, 90], 30], [[90, 100], 10]]

(1)

S := [seq((add(data[k][1])/2)$data[k][2], k=1..numelems(data))]:

Histogram(
  S
  , frequencyscale=absolute
  , discrete=true
  , axis[1]=[tickmarks=[seq(k=cat("[", k-5, ", ", k+5, "["), k in [seq(55..95, 10)])]]
  , thickness=40
  , style=polygon
  , view=[50..100, default]
);

 

 

Download histograms.mw

Please let me/us know if you have a particular need. For instance provide data (or the way they are constructed) and an image of the histogram you would obtain.

3 4 5 6 7 8 9 Last Page 5 of 128