Kitonum

21435 Reputation

26 Badges

17 years, 26 days

MaplePrimes Activity


These are answers submitted by Kitonum

Do not use a variable and an indexed variable with the same name, so I replaced  xi  with  xi_ :

restart;
l := -2;                             
m := 1;                             
k := sqrt(-1/(6*beta))/l;                      
w := (1/5)*alpha/(beta*l);                          
a[2] := -12*sqrt(-1/(6*beta))*alpha*m^2/(5*l*l);                   
a[0] := 0;                              
a[1] := 0;                              
F := -l*C[1]/(m*(C[1]+cosh(l*(xi_+xi[0]))-sinh(l*(xi_+xi[0]))));          
beta := -2;                              
alpha := 3;                               
C[1] := -1/1000;
xi[0] := 1;                               
xi_ := k*x-t*w;
u := a[0]+a[1]*F+a[2]*F*F;  
plot3d(u, x = -3 .. 3, t = -3 .. 3);

 

Do not use a variable and an indexed variable with the same name, so I replaced  f  with  . Also made a few more fixes. Now there are no errors:

restart

PDEtools[declare](f(x), prime = x)

` f`(x)*`will now be displayed as`*f

 

`derivatives with respect to`*x*`of functions of one variable will now be displayed with '`

(1)

H := 0; RE := 50; alpha := (1/180)*(5*3.14)

0

 

50

 

0.8722222222e-1

(2)

A[m] := unapply(-2*alpha*RE*(sum((diff(f[m-n](x), x))*f[n](x), n = 0 .. m))-(4-H)*alpha^2*(diff(f[m](x), x)), x)

proc (x) options operator, arrow; -8.722222222*(sum((diff(f[m-n](x), x))*f[n](x), n = 0 .. m))-0.3043086420e-1*(diff(f[m](x), x)) end proc

(3)

for i from 0 to 6 do A[i] := unapply(expand(subs(m = i, A[m](x))), x) end do

proc (x) options operator, arrow; -8.722222222*(diff(f[0](x), x))*f[0](x)-0.3043086420e-1*(diff(f[0](x), x)) end proc

 

proc (x) options operator, arrow; -8.722222222*(diff(f[1](x), x))*f[0](x)-8.722222222*(diff(f[0](x), x))*f[1](x)-0.3043086420e-1*(diff(f[1](x), x)) end proc

 

proc (x) options operator, arrow; -8.722222222*(diff(f[2](x), x))*f[0](x)-8.722222222*(diff(f[1](x), x))*f[1](x)-8.722222222*(diff(f[0](x), x))*f[2](x)-0.3043086420e-1*(diff(f[2](x), x)) end proc

 

proc (x) options operator, arrow; -8.722222222*(diff(f[3](x), x))*f[0](x)-8.722222222*(diff(f[2](x), x))*f[1](x)-8.722222222*(diff(f[1](x), x))*f[2](x)-8.722222222*(diff(f[0](x), x))*f[3](x)-0.3043086420e-1*(diff(f[3](x), x)) end proc

 

proc (x) options operator, arrow; -8.722222222*(diff(f[4](x), x))*f[0](x)-8.722222222*(diff(f[3](x), x))*f[1](x)-8.722222222*(diff(f[2](x), x))*f[2](x)-8.722222222*(diff(f[1](x), x))*f[3](x)-8.722222222*(diff(f[0](x), x))*f[4](x)-0.3043086420e-1*(diff(f[4](x), x)) end proc

 

proc (x) options operator, arrow; -8.722222222*(diff(f[5](x), x))*f[0](x)-8.722222222*(diff(f[4](x), x))*f[1](x)-8.722222222*(diff(f[3](x), x))*f[2](x)-8.722222222*(diff(f[2](x), x))*f[3](x)-8.722222222*(diff(f[1](x), x))*f[4](x)-8.722222222*(diff(f[0](x), x))*f[5](x)-0.3043086420e-1*(diff(f[5](x), x)) end proc

 

proc (x) options operator, arrow; -8.722222222*(diff(f[6](x), x))*f[0](x)-8.722222222*(diff(f[5](x), x))*f[1](x)-8.722222222*(diff(f[4](x), x))*f[2](x)-8.722222222*(diff(f[3](x), x))*f[3](x)-8.722222222*(diff(f[2](x), x))*f[4](x)-8.722222222*(diff(f[1](x), x))*f[5](x)-8.722222222*(diff(f[0](x), x))*f[6](x)-0.3043086420e-1*(diff(f[6](x), x)) end proc

(4)

"f[0](x):=(a*x^(2))/(2)+1;"

proc (x) options operator, arrow, function_assign; (1/2)*a*x^2+1 end proc

(5)

for m from 0 to 5 do f[m+1] := unapply(simplify(int(int(int(A[m](x), x), x), x)), x) end do

proc (x) options operator, arrow; -0.3634259259e-1*a^2*x^6-.3646938787*a*x^4 end proc

 

proc (x) options operator, arrow; 0.1761045381e-2*a^3*x^10+0.3408151129e-1*a^2*x^8+.1064013001*a*x^6 end proc

 

proc (x) options operator, arrow; -0.7384725559e-4*a^4*x^14-0.2118566073e-2*a^3*x^12-0.1491518225e-1*a^2*x^10-0.1663024406e-1*a*x^8 end proc

 

proc (x) options operator, arrow; a*x^10*(0.2876753716e-5*a^4*x^8+0.1095453285e-3*a^3*x^6+0.1240269629e-2*a^2*x^4+0.4102500165e-2*a*x^2+0.1617319522e-2) end proc

 

proc (x) options operator, arrow; -0.1070986563e-6*a^6*x^22-0.5086533018e-5*a^5*x^20-0.8017885754e-4*a^4*x^18-0.4712189945e-3*a^3*x^16-0.7979893843e-3*a^2*x^14-0.1072411871e-3*a*x^12 end proc

 

proc (x) options operator, arrow; a*x^14*(0.2200899762e-6*a^5*x^10+0.4465825411e-5*a^4*x^8+0.3857331795e-4*a^3*x^6+0.1305645586e-3*a^2*x^4+0.1167941967e-3*a*x^2+0.5157389599e-5+0.3866579693e-8*a^6*x^12) end proc

(6)

F := unapply(add(f[r](x), r = 0 .. 5), x)

proc (x) options operator, arrow; (1/2)*a*x^2+1-0.3634259259e-1*a^2*x^6-.3646938787*a*x^4+0.1761045381e-2*a^3*x^10+0.3408151129e-1*a^2*x^8+.1064013001*a*x^6-0.7384725559e-4*a^4*x^14-0.2118566073e-2*a^3*x^12-0.1491518225e-1*a^2*x^10-0.1663024406e-1*a*x^8+a*x^10*(0.2876753716e-5*a^4*x^8+0.1095453285e-3*a^3*x^6+0.1240269629e-2*a^2*x^4+0.4102500165e-2*a*x^2+0.1617319522e-2)-0.1070986563e-6*a^6*x^22-0.5086533018e-5*a^5*x^20-0.8017885754e-4*a^4*x^18-0.4712189945e-3*a^3*x^16-0.7979893843e-3*a^2*x^14-0.1072411871e-3*a*x^12 end proc

(7)

e1 := subs(x = 1, F(x)) = 0

.2249699361*a+1-0.1797425293e-1*a^2-0.828739687e-3*a^3-0.1540261131e-3*a^4+a*(0.2876753716e-5*a^4+0.1095453285e-3*a^3+0.1240269629e-2*a^2+0.4102500165e-2*a+0.1617319522e-2)-0.1070986563e-6*a^6-0.5086533018e-5*a^5 = 0

(8)

s := {e1}; s := evalf(solve(s, {a}))

{.2249699361*a+1-0.1797425293e-1*a^2-0.828739687e-3*a^3-0.1540261131e-3*a^4+a*(0.2876753716e-5*a^4+0.1095453285e-3*a^3+0.1240269629e-2*a^2+0.4102500165e-2*a+0.1617319522e-2)-0.1070986563e-6*a^6-0.5086533018e-5*a^5 = 0}

 

{a = 12.88012130}, {a = 3.801204750+16.02081577*I}, {a = -18.78808144+20.06115404*I}, {a = -3.539486758}, {a = -18.78808144-20.06115404*I}, {a = 3.801204750-16.02081577*I}

(9)

"F(x):=subs(a=-3.539486758,F(x));"NULL

-1.769743379*x^2+1-.8319047756*x^6+1.290829154*x^4-.2649461846*x^10+.4858345607*x^8-0.2158750698e-1*x^14+0.9432224648e-1*x^12-3.539486758*x^10*(0.4515063372e-3*x^8-0.4857521569e-2*x^6+0.1553805638e-1*x^4-0.1452074501e-1*x^2+0.1617319522e-2)-0.2105841952e-3*x^22+0.2825682275e-2*x^20-0.1258406727e-1*x^18+0.2089506199e-1*x^16

(10)

 

``

Download ADMTRY1_new.mw

Just use the  convert(x, float)  command or  evalf  command  for the finish result.

Use  CodeTools:-Usage  command for this. For ease of comparison, I increased the size of the array:
 

restart; FF := proc (xx::Array, nn::integer) local gg, i, j; gg := 0; for i by 3 to nn do for j from i+3 by 3 to nn do gg := gg+evalf(1/((xx[i]-xx[j])^2+(xx[i+1]-xx[j+1])^2+(xx[i+2]-xx[j+2])^2)) end do end do; return gg end proc; CodeTools:-Usage(FF(Array(1 .. 9999, [seq(i^2, i = 1 .. 9999)]), 9999))

memory used=1.75GiB, alloc change=8.00MiB, cpu time=22.66s, real time=22.12s, gc time=1.72s

 

0.1661350362e-2

(1)

NULL

restart; FF := proc (xx::Array, nn::integer) local gg, i, j; gg := add(add(1/((xx[i]-xx[j])^2+(xx[i+1]-xx[j+1])^2+(xx[i+2]-xx[j+2])^2), j = i+3 .. nn, 3), i = 1 .. nn, 3); return gg end proc; XX := Array(1 .. 9999, [seq(i^2, i = 1 .. 9999)]); CodeTools:-Usage(evalf(FF(XX, 9999)))

memory used=58.28GiB, alloc change=59.49MiB, cpu time=2.65m, real time=2.43m, gc time=71.55s

 

0.1661398690e-2

(2)

``

``


 

Download procedure_new1.mw

I think the problem can be solved in different ways. Below is an example of visualization of coin tosses. CoinToss procedure returns the result of N coin tosses in the form of a list of coordinates of the vertices of the broken line. Each segment up means the fall of one side of a coin, down - the other one. As an example, a simulation of 20 tosses of 2 independent coins is given. Animation of this is also shown.


 

restart;
CoinToss:=proc(N::posint,h:=0)
local S, r, n, t;
S[0]:=[0,h];
r:=rand(0..1);
for n from 1 to N do
t:=r();
S[n]:=[n,S[n-1][2]+(-1)^t];
od;
convert(S, list);
end proc:

A:=CoinToss(20,0.1);
B:=CoinToss(20);

[[0, .1], [1, 1.1], [2, 2.1], [3, 3.1], [4, 2.1], [5, 3.1], [6, 2.1], [7, 1.1], [8, .1], [9, 1.1], [10, .1], [11, -.9], [12, -1.9], [13, -.9], [14, .1], [15, -.9], [16, .1], [17, -.9], [18, .1], [19, -.9], [20, .1]]

 

[[0, 0], [1, -1], [2, -2], [3, -3], [4, -4], [5, -3], [6, -2], [7, -1], [8, -2], [9, -1], [10, -2], [11, -1], [12, -2], [13, -3], [14, -2], [15, -1], [16, -2], [17, -3], [18, -4], [19, -5], [20, -4]]

(1)

F:=n->plot([A[1..n+1],B[1..n+1]],color=[red,blue], scaling=constrained, thickness=3, size=[1000,400], legend=["1st coin","2nd coin"]);
F(20);

proc (n) options operator, arrow; plot([A[1 .. n+1], B[1 .. n+1]], color = [red, blue], scaling = constrained, thickness = 3, size = [1000, 400], legend = ["1st coin", "2nd coin"]) end proc

 

 

plots:-animate(plots:-display,['F'(round(k))], k=0..20, frames=100, size=[1000,400], scaling=constrained);

 

 

 


 

Download CoinToss.mw

 

I think that it will be interesting for you to get the law of distribution of the number of points when throwing  n dices. In other words, it is necessary to find the probability that when throwing  n dice the sum of points will be equal to  S  for any possible S . For this we can use the procedure  Composition . Details on the use of this procedure can be found here.

Composition := proc (n::nonnegint, k::posint, res::{range, nonnegint} := 0)
local a, b, It, L0; 
if res::nonnegint then a := res; b := n-(k-1)*a  else a := lhs(res); b := rhs(res) fi;
if b < a or b*k < n then return `No solutions` fi; 
It := proc (L)
local m, j, P, R, i, N;
m := nops(L[1]); j := k-m; N := 0;
for i to nops(L) do
R := n-`+`(op(L[i]));
if R <= b*j and a*j <= R then N := N+1;
P[N] := [seq([op(L[i]), s], s = max(a, R-b*(j-1)) .. min(R, b))] fi;
od;
[seq(op(P[s]), s = 1 .. N)];
end proc;
L0 := [[]];
(It@@k)(L0); 
end proc:


Example of use - find all the ways to get a total of 12 points when throwing 3 dice:

Composition(12, 3, 1..6);
nops(%);      

   [[1, 5, 6], [1, 6, 5], [2, 4, 6], [2, 5, 5], [2, 6, 4], [3, 3, 6], [3, 4, 5], [3, 5, 4], [3, 6, 3], [4, 2, 6], [4, 3, 5], [4, 4, 4], [4, 5, 3], [4, 6, 2], [5, 1, 6], [5, 2, 5], [5, 3, 4], [5, 4, 3], [5, 5, 2], [5, 6, 1], [6, 1, 5], [6, 2, 4], [6, 3, 3], [6, 4, 2], [6, 5, 1]]
                                                                     25

In the example below we obtain the law of distribution of the amount of points when rolling 4 dice :

n:=4:
# Probabilities
P:=[seq([S,nops(Composition(S,n,1..6))/6^n], S=n..6*n)];
# Check
add(P[k,2], k=1..nops(P));

     
            

Edit.

      

Your integral equation has the exact solution  u(x)=1+3/4*x . The solution using the trapezoid rule for  N=100  gives a pretty good approximation:


 

restart;
Eq:=u(x) = 1+int(x*t*u(t), t = 0 .. 1);
u:=x->1+3/4*x;
Eq;  # Check of exact solution

u(x) = 1+int(x*t*u(t), t = 0 .. 1)

 

proc (x) options operator, arrow; 1+(3/4)*x end proc

 

1+(3/4)*x = 1+(3/4)*x

(1)

restart;
N:=100:
u[0]:=1.:
X:=[seq(1/N*k, k=1..N)]:
x[0]:=0.:
assign(seq(x[i]=X[i], i=1..N)):
h:=1/N:
Sys:={seq(u[k]=1+add((x[k]*x[i-1]*u[i-1]+x[k]*x[i]*u[i])/2*h, i=1..N), k=1..N)}:

Sol:=solve(Sys);

{u[1] = 1.007500188, u[2] = 1.015000375, u[3] = 1.022500563, u[4] = 1.030000750, u[5] = 1.037500938, u[6] = 1.045001125, u[7] = 1.052501313, u[8] = 1.060001500, u[9] = 1.067501688, u[10] = 1.075001875, u[11] = 1.082502063, u[12] = 1.090002250, u[13] = 1.097502438, u[14] = 1.105002625, u[15] = 1.112502813, u[16] = 1.120003000, u[17] = 1.127503188, u[18] = 1.135003375, u[19] = 1.142503563, u[20] = 1.150003750, u[21] = 1.157503938, u[22] = 1.165004125, u[23] = 1.172504313, u[24] = 1.180004500, u[25] = 1.187504688, u[26] = 1.195004875, u[27] = 1.202505063, u[28] = 1.210005250, u[29] = 1.217505438, u[30] = 1.225005625, u[31] = 1.232505813, u[32] = 1.240006000, u[33] = 1.247506188, u[34] = 1.255006375, u[35] = 1.262506563, u[36] = 1.270006750, u[37] = 1.277506938, u[38] = 1.285007125, u[39] = 1.292507313, u[40] = 1.300007500, u[41] = 1.307507688, u[42] = 1.315007875, u[43] = 1.322508063, u[44] = 1.330008250, u[45] = 1.337508438, u[46] = 1.345008625, u[47] = 1.352508813, u[48] = 1.360009000, u[49] = 1.367509188, u[50] = 1.375009375, u[51] = 1.382509563, u[52] = 1.390009750, u[53] = 1.397509938, u[54] = 1.405010125, u[55] = 1.412510313, u[56] = 1.420010500, u[57] = 1.427510688, u[58] = 1.435010875, u[59] = 1.442511063, u[60] = 1.450011250, u[61] = 1.457511438, u[62] = 1.465011625, u[63] = 1.472511813, u[64] = 1.480012000, u[65] = 1.487512188, u[66] = 1.495012375, u[67] = 1.502512563, u[68] = 1.510012750, u[69] = 1.517512938, u[70] = 1.525013125, u[71] = 1.532513313, u[72] = 1.540013500, u[73] = 1.547513688, u[74] = 1.555013875, u[75] = 1.562514063, u[76] = 1.570014250, u[77] = 1.577514438, u[78] = 1.585014625, u[79] = 1.592514813, u[80] = 1.600015000, u[81] = 1.607515188, u[82] = 1.615015375, u[83] = 1.622515563, u[84] = 1.630015750, u[85] = 1.637515938, u[86] = 1.645016125, u[87] = 1.652516313, u[88] = 1.660016500, u[89] = 1.667516688, u[90] = 1.675016875, u[91] = 1.682517063, u[92] = 1.690017250, u[93] = 1.697517438, u[94] = 1.705017625, u[95] = 1.712517813, u[96] = 1.720018000, u[97] = 1.727518188, u[98] = 1.735018375, u[99] = 1.742518563, u[100] = 1.750018750}

(2)

Y:=map(rhs, convert(Sol,list));

[1.007500188, 1.015000375, 1.022500563, 1.030000750, 1.037500938, 1.045001125, 1.052501313, 1.060001500, 1.067501688, 1.075001875, 1.082502063, 1.090002250, 1.097502438, 1.105002625, 1.112502813, 1.120003000, 1.127503188, 1.135003375, 1.142503563, 1.150003750, 1.157503938, 1.165004125, 1.172504313, 1.180004500, 1.187504688, 1.195004875, 1.202505063, 1.210005250, 1.217505438, 1.225005625, 1.232505813, 1.240006000, 1.247506188, 1.255006375, 1.262506563, 1.270006750, 1.277506938, 1.285007125, 1.292507313, 1.300007500, 1.307507688, 1.315007875, 1.322508063, 1.330008250, 1.337508438, 1.345008625, 1.352508813, 1.360009000, 1.367509188, 1.375009375, 1.382509563, 1.390009750, 1.397509938, 1.405010125, 1.412510313, 1.420010500, 1.427510688, 1.435010875, 1.442511063, 1.450011250, 1.457511438, 1.465011625, 1.472511813, 1.480012000, 1.487512188, 1.495012375, 1.502512563, 1.510012750, 1.517512938, 1.525013125, 1.532513313, 1.540013500, 1.547513688, 1.555013875, 1.562514063, 1.570014250, 1.577514438, 1.585014625, 1.592514813, 1.600015000, 1.607515188, 1.615015375, 1.622515563, 1.630015750, 1.637515938, 1.645016125, 1.652516313, 1.660016500, 1.667516688, 1.675016875, 1.682517063, 1.690017250, 1.697517438, 1.705017625, 1.712517813, 1.720018000, 1.727518188, 1.735018375, 1.742518563, 1.750018750]

(3)

plot([0,X[]],Y, view=[0..1,0..2], scaling=constrained);

 

 


 

Download IntEq.mw

I did not find a way to increase the size of this font inside Maple. As a workaround, you can use a Windows screen magnifier or just wear glasses. See the screenshot:

If you have specific points, you can use  geom3d  package.

Example:

restart;
with(geom3d):
point(P, 5, 6, 7);
point(A, 1, -2, 3);
point(B, 2, 4, 1);
line(AB, [A,B]);
projection(Q, P, AB);
detail(Q);
                               

 

 

A:=isolve(n+k=2*c);
is(A<>NULL and eval(n, A)::name);
                          
A := {c = _Z1, k = 2*_Z1-_Z2, n = _Z2}
                                                       true

Above  _Z1  and  _Z2  are any integers.

You can use  PolyhedralSets  package to get the vertices and edges of your polygon. This also works in the multidimensional case.

Your example (failed to load the contents of the file, so the image is shown, the link to the file below):


You can extract all vertices in one list with  Relations  command:
V:=Vertices(ps):
Relations~(V);
map(v->eval([x,y],v), %);
               
  [[y = -1, x = -1], [y = 1, x = -1], [y = -1, x = 1], [y = 1, x = 1]]
                                       [[-1, -1], [-1, 1], [1, -1], [1, 1]]

The same for edges.

 

Download PS.mw


 

 

Use  factors  command for this:

f:=x*(x+1)^4*(x^2+x+1)*(x^3+x^2+1)^5:
factors(f);
map(t->op(1,t), %[2]);
sort(%);
                         

 

I usually use  is  command for such checks:

is(2*cos(phi)^2-1=cos(2*phi));
                                                             
true


And more often I look  here , if I don’t know any rare identity.


Edit.

Maple 2018.2 returns the result in the form of finite sums and products (without hypergeometric functions):

restart;
int(sin(x)^n, x) assuming n::posint;
eval(%, n=10);
value(%);
int(sin(x)^10, x); # The direct calculation

      

restart;
Ke := Matrix(4, 4, {(1, 1) = (12*I)*E/l^3, (1, 2) = (6*I)*E/l^2, (1, 3) = -(12*I)*E/l^3, (1, 4) = (6*I)*E/l^2, (2, 1) = (6*I)*E/l^2, (2, 2) = (4*I)*E/l, (2, 3) = -(6*I)*E/l^2, (2, 4) = (2*I)*E/l, (3, 1) = -(12*I)*E/l^3, (3, 2) = -(6*I)*E/l^2, (3, 3) = (12*I)*E/l^3, (3, 4) = -(6*I)*E/l^2, (4, 1) = (6*I)*E/l^2, (4, 2) = (2*I)*E/l, (4, 3) = -(6*I)*E/l^2, (4, 4) = (4*I)*E/l}):
k:=E*I/l^3:
``(k).(Ke/k);

                        

 

First 96 97 98 99 100 101 102 Last Page 98 of 289