## 511 Reputation

18 years, 334 days

## sin, simplify...

Maple

How does Maple  reduce that to unity? Thanks.

S := `assuming`([simplify(-sin(Pi*(alpha+n+beta))*sin(Pi*beta)/(sin(Pi*(alpha+beta))*sin(Pi*(-1+n+beta))), trig)], [`and`(`and`(alpha::real > 0, beta::real > 0), n::posint)])

## how to create a distribution?...

Maple

I create a continous random variable having an arbitrary pdf and characterize the corresponding distribution:

pdf := piecewise(a <= x and x <= b, 1, 0): f := unapply(pdf, x): R := Statistics:-RandomVariable(Statistics:-Distribution(PDF = f)): `assuming`([map(apply, [Statistics:-MGF, Statistics:-CGF, Statistics:-PDF, Statistics:-CDF, Statistics:-Moment], R, t)], [a < b]) ;

## two lists trasform using map?...

Maple

Various transformations on the members of a list can be easily done using things like `+`(op(map(f, L))) for a list L and a function f (e.g., f:=x->x^2 to get sum of squares). How can we do such transformations on two or more lists using map? For example, how do we do most effectively squared sum of differences between the corresponding elements of two lists?

## How do I do it effectively?...

Maple

Can it be done simpler/better/faster?

F3 := proc (n) options operator, arrow; ln(n)*mul(evalf(1-1/i), i = seq(ithprime(i), i = 1 .. n)) end proc; F3(100000); evalf(%);

F2 := proc (n) options operator, arrow; -ln(ln(n))+add(evalf(1/i), i = seq(ithprime(i), i = 1 .. n)) end proc; F2(100000); evalf(%);

F1 := proc (n) options operator, arrow; ln(n)-add(evalf(ln(i)/i), i = seq(ithprime(i), i = 1 .. n)) end proc; F1(5000); evalf(%);

## How define discr. distribution?...

Maple

How do I define a distribution with an arbitrary mass function so it can be used exactly like those predifined, e.g., Statistics:-Mean(Poisson(lambda), Statistics:-MGF(Poisson(lambda),t), etc? As an example, Rademacher distribution can be used, or its straighforward generalization with probability of +1 being equal to p and that of -1 equal to 1-p=q. Thanks.

 4 5 6 7 8 9 Page 6 of 9
﻿