## Factorizing simple expression...

How do I get Maple to factorize this simple expression without too much effort?

f:=3/2 + sqrt(8*k + 2) + 2*k

## How can I create a probability distribution table ...

I want to create a distribution table and then find expected value,variance and standard deviation.

For example : X=-1,P(X)=0.2
X=0,P(X)=0.25
X=1,P(X)=0.35

X=2,P(X)=0.2

E(X) would then equal -1*0.2+0*0.25+1*0.35+2*0.2.

How can I do all of this with Maple ?

## How should linearization a nonlinear equation with...

How should linearization a nonlinear equation with maple?

## ExpectedValue Function...

I'm trying to use the ExpectedValue function to get the next close value of a stock.

restart; with(Finance)

W := WienerProcess()

T := 1.0

S := SamplePath(W(t), t = 0 .. T, timesteps = 100, replications = 10^4)

A := S[1 .. 10^4, 50]

TI := 1

AN := 100 (Start Value)

sigma := 3.5 (volatility)

r := 0.5e-1    (interest)

ANF := AN*exp((r-(1/2)*sigma^2)*TI+sigma*W(TI))       (ANF: is the forecasting Value)

ExpectedValue(ANF, timesteps = 100, replications = 10^3)

Is this approach right?

## How to disable this things ? ...

Why it be like that and how to solve it ?

## How can I fix "Error, (in dsolve/numeric/process_i...

>restart;
> ODEtools[declare]((S, L, B)(t), prime = t);
ODEtools[declare](S(t), L(t), B(t), prime = t)
> DE1 := diff(S(t), t) = -L*S*beta-`&mu;S`+mu;
d
DE1 := --- S(t) = -L S beta - &mu;S + mu
dt
> DE2 := diff(L(t), t) = L*S*beta-(gamma+mu)*S;
d
DE2 := --- L(t) = beta S L - (gamma + mu) S
dt
> DE3 := diff(B(t), t) = L*gamma-gamma*mu;
d
DE3 := --- B(t) = L gamma - gamma mu
dt
> init_conds := S(0) >= 0, L(0) >= 0, B(0) >= 0;
init_conds := 0 <= S(0), 0 <= L(0), 0 <= B(0)
> sys := {init_conds, diff(B(t), t) = L*gamma-gamma*mu, diff(L(t), t) = L*S*beta-(gamma+mu)*S, diff(S(t), t) = -L*S*beta-`&mu;S`+mu};

> sol := dsolve(sys, numeric, parameters = [mu, beta, gamma, S(t), L(t), B(t)], method = rkf45);

Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations

> sol(parameters = [mu = .234, beta = 2.345, gamma = 5.678, S(t) = 6.678, L(t) = 6.789, B(t) = 7.123]);
sol(parameters = [mu = 0.234, beta = 2.345, gamma = 5.678, S(t) = 6.678, L(t) = 6.789, B(t) = 7.123])

## possible bug in pdsolve. Too many levels of recurs...

Is the following a bug? I am using Maple 2019  64 bit with latest Physics package 357 on windows 10.

 > restart;
 > pde :=  diff(w(x,y,z),x)+(y^2- a*exp(alpha*x)*(x*y-1))*diff(w(x,y,z),y)+(c*exp(beta*x)*z^2+b*exp(-beta*x))*diff(w(x,y,z),z)= 0; sol:=pdsolve(pde,w(x,y,z));

Error, (in depends) too many levels of recursion

 > restart;
 > pde :=  diff(w(x,y,z),x)+ (b*exp(alpha*x)*y^2 + a*exp(beta*x)*(beta- a*b*exp((alpha+beta)*x)))*diff(w(x,y,z),y)+(c*z^2*exp(gamma*x)+ d*z + k*exp(-gamma*x))*diff(w(x,y,z),z)= 0; sol:=pdsolve(pde,w(x,y,z));

Error, (in depends) too many levels of recursion

 > restart;
 > pde :=  x*diff(w(x,y,z),x)+ ( a1*exp(alpha*x)*y^2 + beta*y+ a1*b2^2*x^(2*beta)*exp(alpha*x))*diff(w(x,y,z),y)+(a2*x^(2*n)*z^2*exp(lamba*x)+(b2*x^n*exp(lambda*x) - n)*z + c*exp(lambda*x))*diff(w(x,y,z),z)= 0; sol:=pdsolve(pde,w(x,y,z));

Error, (in depends) too many levels of recursion

 >

## Code for a Recurrence Matrix...

I want to find following NxN matrix P                                           (N=2^k.M where k and M are a positive integers)

My Code Try: question.mw

```restart:
with(LinearAlgebra):
interface(rtablesize=20):
k:=2:
M:=4:
N:=2^k*M:
for i from 1 to M do
S:= (sqrt(2)/2^k)*Matrix(M,M, (i,j)-> `if`(`and`(i::odd,j=1) ,-1/(i*(i-2)),0)):
end do:
C:= (1/2^k)*BandMatrix( [ [ seq(-1/(2*sqrt(2)*(i-1)*(i-3)), i=4..M)], [ 1, seq(0*i,i=1..M-1) ],[ seq(4/2*(i-3),i=2..M)]
]
); #I think the matrix C is not same in the question

Gen:=proc(K::posint,A,B)
Matrix(scan=triangular[upper],[seq([A,seq(B,i=j..2^(K)-1)],j=1..2^(K))]);
end proc:
P:=Gen(k,C,S);

```

question.mw

## working with subsets...

Hello,

Is there any way to make this kind of problem in Maple?

I have to find the intersection of subsets, and if there is no intersection then to multiply elements of the subsets. For example,

A={x6,x4,x2,x7,x8,x9,x10},  B={x2,x3,x5,x8} and C={x4,x9,x11,x12,x13}.

Now, the intersection of A and B is {x2}, after that, I don't have the intersection with C, so the solution is x2x4, x2x9, x2x11, x2x11 and x2x13.

Another solution is to make the intersection of A and C and it will be {x4,x9} and after that, I don't have the intersection with B so I have to multiply x4 and x9 with elements in B (obviously, the first solution is better because it has fewer terms)

Is something like this is possible to do in Maple and how?

## Help on using dsolve...

Hello

I am using Maple to solve a couple of differential equations.  Here is what I did so far

```k := 141/10000;
yB0 := 296/1000;
e := -148/1000;
Ff0 := 67844/1000;
Far0 := 323066/1000;
FB0 := 135688/1000;
P0 := 10;
x0 := 0;
a := 38/1000;
dsys:={diff(x(w),w)=(k*((yB0*p(w)*(1 - x(w)))/(1 + e*x(w)))^(1/3)*(Ff0/(Far0 + FB0)*p(w)*((Ff0/FB0 - 1/2*x(w))/(1 + e*x(w))))^(2/3))/FB0,
diff(p(w),w)=P0*(-a)/(2*p(w)/P0)*(1 + e*x(w)),x(0)=x0,p(0)=P0}:
dsn1:≔dsolve(dsys,numeric,[x(w),p(w)],stiff=true);

```

Maple returns neither an error message or a solution.   I am sure I have mistyped something or did not understand how dsolve works at all.

Can you help me out?

Many thanks

Ed

PS. How to plot the solution?

## Survivor probability question...

On CBS tv show Survivor S38E4, an interesting scenario arose. There was initially 2 teams comprising 6 persons (blue team) and 9 persons (yellow team). Then they decided to mix it up, and split it into 3 teams. Each player was randomly assigned a buff, (red, green or orange =3 colored buffs *5).= 3 teams of 5.

What was interesting was 5 out of the original 6 blue team are now in the new red team. 5 of the original yellow team are in the new green team and 4 of the original yellow team are in the new orange team.

What is the chances of that happening?
A couple of attempts:

survivor_rand.mw

## Matrix of P with the help of loop...

How i can generate Pr matrix when P= -x and x0=-1 , x1=-2/3 , x2=-1/3 , and x3=0 with the help loop?

## obtain the derivatives...

Hi everybody:

I have one equation:

EQ := V^3-R*T*V^2/P-(B^2+P*B*R*T*sqrt(T)/(P-A))*V-A*B/(P*sqrt(T)) = 0;
how can I obtain these derivatives:

## How to remove all output from a worksheet?...

I just noticed with chagrin that one of my favorite menu commands, Edit -> Remove output -> From worksheet, is missing from Maple 2019's Standard GUI. Is there a keyboard command or toolbar item to replace it?