Kitonum

21445 Reputation

26 Badges

17 years, 46 days

MaplePrimes Activity


These are answers submitted by Kitonum

The same bug in Maple 2018.2. Here are 2 workarounds:

restart;
U:= Matrix(4, {seq((i,i)=1,i=1..4), seq(seq((i,j)=u[i,j],j=i+1..4),i=1..3)});
-U;

# Or

U:= Matrix(4, (i,j)->`if`(i=j,1,`if`(j>i,u[i,j],0)));
-U;

 

Here is another approach to solving equations using the  identify  command. Here we first find the roots numerically, and then try to get their symbolic representation. This method is especially useful when solving transcendental equations for which the  solve  command does not work (second example below). These examples works in Maple 2017.3:
 

restart;
Student:-Calculus1:-Roots((x-1)*(x^3-9*x^2+4),numeric);
evalc~(identify(%));
simplify(map2(eval,(x-1)*(x^3-9*x^2+4)=0,x=~%));  # Check

[-.6440222815, .6939575790, 1., 8.950064703]

 

[-3*cos((1/3)*arctan((2/25)*26^(1/2)))+3-3*3^(1/2)*sin((1/3)*arctan((2/25)*26^(1/2))), -3*cos((1/3)*arctan((2/25)*26^(1/2)))+3+3*3^(1/2)*sin((1/3)*arctan((2/25)*26^(1/2))), 1, 6*cos((1/3)*arctan((2/25)*26^(1/2)))+3]

 

[0 = 0, 0 = 0, 0 = 0, 0 = 0]

(1)

Eq:=sin(x)-6*x/Pi/2=0;
solve(Eq, explicit);
allvalues(%);
Student:-Calculus1:-Roots(sin(x)-6*x/Pi/2=0, numeric);
identify(%);
map2(eval,Eq,x=~%);  # Check

sin(x)-3*x/Pi = 0

 

RootOf(-sin(_Z)*Pi+3*_Z)

 

RootOf(-sin(_Z)*Pi+3*_Z, .5235987756), RootOf(-sin(_Z)*Pi+3*_Z, -.5235987756), 0

 

[-.5235987756, 0., .5235987756]

 

[-(1/6)*Pi, 0, (1/6)*Pi]

 

[0 = 0, 0 = 0, 0 = 0]

(2)

 


 

Download identify.mw

 

s:=solve((hv*hw+lv*lw)/(lv+hv)*(lv+hv) = dw*(lv+hv), hv):
expand(``(-numer(s))/``(-denom(s)));

 

To solve this equation it is better to use  the Student:-Calculus1:-Roots  command. In your example, it immediately returns all 4 roots in symbolic form (in Maple 2018.2):

Student:-Calculus1:-Roots((x-1)*(x^3-9*x^2+4), x);
evalf(%);
     
          
                          

I confirm this bug in 2d math input in Maple 2018.2. Here is a workaround:


Here is the simplest way to insert a matrix from the keyboard:

<1, 1; 1, 2/3.4>;
                                              


 

NULL

NULL

restart

NULL

Digits := 20

20

(1)

``

``

NULL

c := .95

.95

(2)

NULL

theta := .9

.9

(3)

k := 1.

1.

(4)

p_l := 10^(-15.)

0.10000000000000000000e-14

(5)

n := 10^10.

10000000000.

(6)

NULL

fsolve(c = p_l^k*(1-p_l)^(n-k)*theta/(p_l^k*(1-p_l)^(n-k)*theta+p^k*(1-p)^n*(1-theta)), p = 1.09*10^(-10) .. .1)

0.14965925863591907056e-8

(7)

NULL

NULL

NULL

``

NULL

NULL

NULL

NULL

NULL

NULL

NULL

NULL

NULL

NULL

NULL

NULL


 

Download test_(4)_new.mw

The functions and the colors should be specified as lists not sets:

w:=x+I*y:
plots[implicitplot]([Im(w) = 2, Re(w) = 2], x = -5 .. 5, y = -5 .. 5, color = ["Blue", "Red"]) ; 


I do not use 2D math input at least because the code typing in it takes more time.

Kollect:=proc(L::set, n::posint)
uses combinat;
`+`(seq(`+`(mul~(choose(L minus {i},n))[])*i^n, i=L));
end proc:

Examples of use:
Kollect({i1, i2, i3, i4}, 2);
Kollect({a, b, c, d, e}, 3);

 

simplify(a, {alpha^2=0});

You can prevent automatic fraction reduction using inert  sqrt :

%sqrt(x)/x;
value(%); 
                                        

 

This is probably due to rounding errors. If you increase  Digits , the plots are identical:

restart;
Digits:=50:
plot(sqrt(Pi/(2*x))*BesselJ(3+1/2, x), x = 0 .. 0.5e-1);
plot(sqrt(Pi/(2*x))*BesselJ(3+.5, x), x = 0 .. 0.5e-1);

 

Perhaps this is a bug. As a workaround use  CurveFitting:-LeastSquares  instead:

CurveFitting:-LeastSquares(pts1, pts2, x, curve = 3*x+a);
                                   
 -61/3+3*x

restart;

Ec := (Ems+I*Eml)*(1+((Ems+I*Eml)/Ef-1)*Zeta*phi/((Ems+I*Eml)/Ef+Zeta))/(1-((Ems+I*Eml)/Ef-1)*phi/((Ems+I*Eml)/Ef+Zeta));

a:=simplify(Re(Ec)) assuming positive;
b:=simplify(Im(Ec)) assuming positive;

a  and  b  are the real and imaginary parts of  Ec .


 

restart

A := binomial(n, k)

`assuming`([limit(A*(lambda/n)^k*(1-lambda/n)^(n-k), n = infinity)], [lambda > 0, lambda < n, k::posint])

lambda^k/(GAMMA(k)*k*exp(lambda))

(1)

simplify(convert(%, factorial))

lambda^k*exp(-lambda)/factorial(k)

(2)

`assuming`([limit(eval(A*(lambda/n)^k*(1-lambda/n)^(n-k), k = 0), n = infinity)], [lambda > 0, lambda < n])

exp(-lambda)

(3)

``


 

Download Poisson.mw

Edit.


 

restart

A := binomial(n, k); assume(p >= 0, p <= 1)

binomial(n, k)

(1)

E := sum(A*p^k*(1-p)^(n-k)*k, k = 0 .. n)

(p/(1-p)+1)^n*p*n*(1-p)^n/((1-p)*(p/(1-p)+1))

(2)

E := simplify(E)

p*n

(3)

simplify(sum(A*p^k*(1-p)^(n-k)*(k-E)^2, k = 0 .. n))

-p*n*(-1+p)

(4)

subs(-1+p = -q, %)

p*n*q

(5)

NULL


 

Download simpl_new.mw


Edit.

First 94 95 96 97 98 99 100 Last Page 96 of 289