## 40 Reputation

0 years, 107 days

## Statistics: How to calculate the avarage...

Maple 2023

As I am new to using the statistics package, I have some doubts about how to perform certain operations in Maple.

For example, let sigma be a variable containing any real number, finding the average is easy, just use the command A0:=Median(sigma) and if you want A (see image below) just take A1:=A0^2. However, the terms that make up <sigma^2> cause a certain difficulty, how to do this? In other words, calculate the B of the image?

`sigma := [2, 4, 0, 6]`

```AMedia := (2 + 4 + 0 + 6)/4; AMedia1 := AMedia^2;```

`A0 := Median(sigma)`

`A1 := A0^2`

`BMedia := (2^2 + 4^2 + 0^2 + 6^2)/4`

`sigma0 := sigma^2`

`sigma1 := Mean(sigma0)`

.......................................................................................

## Collect terms in the denominador...

Maple 2023

I need to highlight all terms that contain eta, my variable, for example (A0)+(A1)*1/eta+(A2)*1/eta^2+...(An)**1/eta^n and so on in my expression call from P. However, when I select eta through the collect command, maple is unable to carry out the command.

```P := expand((cosh(k*eta) + alpha*m*sinh(k*eta)/eta)^3); P := convert(P, exp); P := expand(P); P := collect(P, eta); P := combine(P);```

Once these have are in evidence I need to select the coefficients A0, A1, A2, etc. How to proceed if eta are in the denominator and maple does not work with this possibility? This it'was my tentative

`B0 := subs(eta = 0, P);`

`B1 := coeff(P, eta)`

`B2 := coeff(P, eta^2)`

I actually tested the possibility of  1/eta instead of  eta and it didn't work

## what is the better way to simplificar th...

Maple 2023

Anteriorly, I had done a question that you answered in the forum and it basically it was about the simplification of a equation. I'm posting the print of the screen and the code because the question of today is similarly, but not completely, because there are something that make more complicate the code that I devolved.

```restart; Hi := -Delta*S1^2 - J*S1*S2; R1 := S1*exp(-beta*Hi); R1 := add(R1, S1 = [--1, 0, 1]); R2 := exp(-beta*Hi); R2 := add(R2, S1 = [-1, 0, 1]); S := R1/R2; S := convert(S, trig, {J*S2}); S := simplify(S); S := convert(S, exp, {Delta});```

In this case I had to put in evidence the therm exp(Delta beta), where I simplified the expression. Now, we have more 2 variables (+2 and -2) to substitute in the equation. The code is:

```restart; Hi := -Delta*S1^2 - J*S1*S2; R1 := S1*exp(-beta*Hi); R1 := add(R1, S1 = [-2, -1, 0, 1, 2]); R2 := exp(-beta*Hi); R2 := add(R2, S1 = [-2, -1, 0, 1, -2]); S := R1/R2; S := convert(S, trig, {J*S2}); S := simplify(S); S := convert(S, exp, {Delta});```

In the last line we had the final equation

What should I change in the code for that my exponential function continue in evidence? This is, for my expression  be

`(4*sinh(2*J*S2*beta) + 2*sinh(J*S2*beta)*exp(-3*Delta*beta))/(2*cosh(2*J*S2*beta) + 2*cosh(J*S2*beta)*exp(-3*Delta*beta) + exp(-4*Delta*beta))`

## How to solve the system algebraically?...

Maple 2023

In the system below, I need to solve the solution algebraically (it is known in advance that from "V3" that a0=1,just open the V3 command).

```V := exp(lambda*S) = S^4*a4 + S^3*a3 + S^2*a2 + S*a1 + a0; V1 := subs(S = 2, V); V2 := subs(S = 1, V); V3 := subs(S = 0, V); V4 := subs(S = -1, V); V5 := subs(S = -2, V); fsolve(subs(a0 = 1, {V1, V2, V4, V5}), {a1, a2, a3, a4});```

I already know the answers, but I need maple to provide me with the command in the form

a1:=(1/6)*[8*sinh(lambda)-sinh(2*lambda)] and

a2:=(1/12)*[16*cosh(lambda)-cosh(2*lambda)-15],

a3:= ... etc.

What is the best way to do this?

## How to exclude integer terms that are no...

Maple

Once the terms have been selected, as below

I only need to keep terms that contain a certain function with generic arguments, for example, tanh(x), in this case, that is, I want from A01

-(m2/4) tanh(2k-2ç)+(m2/16) tanh(4k+2ç)+-(m2/4) tanh(2k+2ç)+(3m2/8) tanh(2ç)

and delete the terms

3/16-(3/16)m2^2

What's the best command to make that? In other words, always exclude terms that do not accompany tanh

 1 2 Page 1 of 2
﻿