Kitonum

21835 Reputation

26 Badges

17 years, 221 days

MaplePrimes Activity


These are answers submitted by Kitonum

restart;
with(GraphTheory):
with(RandomGraphs):
P:=combinat:-permute([$ 1..7]):
L:=[seq(RandomTree(7), i=1..50)]:
U:=map(Edges, L):
f:=(x,y)->convert([seq(x=subs(zip(`=`, [$ 1..7], P[n]), y), n=1..nops(P))], `or`):
S:=[ListTools:-Categorize(f, U)]:
plots:-display(Matrix(3,4,[DrawGraph(Graph([$ 1..7], {seq({i,i+1}, i=1..6)})), seq(DrawGraph(Graph([$ 1..7],S[i,1])), i=1..nops(S)),plot([[0,0]], axes=none)]));




Even with a large number of repetitions, for some reason Maple does not generate the graph on the first picture. Therefore, it was specified for plotting manually.

 


 

fq := proc (p) options operator, arrow; piecewise(p < -5, 0., p < -3, .161711971*(p+5.)^3, p < -1, (-1)*1.798464149*p^2+(-1)*.544033315*p+7.541565235+(-1)*.3076373305*p^3, p < 1, 0.809338641e-1*p^3+(-1)*.6327505649*p^2+.6216802691*p+7.930136430, p < 3, 0.7445052690e-1*p^3+(-1)*.613300552*p^2+.602230257*p+7.936619768, p < 5, 0.19182821e-2*p^3+0.39489651e-1*p^2+(-1)*1.35614035*p+9.894990378, p < 7, (-1)*0.256603524e-2*p^3+.106754411*p^2+(-1)*1.69246414*p+10.45553002, p < 9, (-1)*0.254356370e-2*p^3+.106282509*p^2+(-1)*1.68916084*p+10.44782231, p < 11, (-1)*0.2031067084e-1*p^3+.585994401*p^2+(-1)*6.00656786*p+23.40004343, p < 13, 0.4137545813e-1*p^3+(-1)*1.449647855*p^2+16.38549696*p-58.70419431, p < 15, (-1)*0.273325019e-1*(p-15.)^3, 15 <= p, 0.) end proc

m := proc (p) options operator, arrow; `if`(1 <= p and p <= 9, fq(p), undefined) end proc;

proc (p) options operator, arrow; `if`(1 <= p and p <= 9, fq(p), undefined) end proc

 

 

``


 

Download PiecewiseTruncate_new.mw

add(`if`(j=1, 2^j, 3^j), j=1..2);
                                                                 11


or

add(eval(x^j, [`if`(j=1, x=2, x=3)]), j=1..2);
                                                                 11


or

f:=j->piecewise(j=1, 2^j, 3^j):
add(f(j), j=1..2);

                                                                 11

 

Addition.  Usually sum  command is used  for symbolic summation with an indefinite (non-numeric)  number of summands or for summing series with an infinite number of terms, for example:

sum(1/2^k, k=1..n);
sum(1/2^k, k=1..infinity);

 

 

plots:-implicitplot(sqrt(S)*sqrt(1+S)-arcsinh(sqrt(S))=t, t=0..3, S=0..3, color=red, labels=[t,S(t)]);


 

restart;
with(plots):
A:=2: f:=440.: nu:=340: lambda:=nu/f: x[fast]:=1: T:=1/f: antal:=200: t[max]:=10*T: g:=(x,t)->A*sin(2*Pi/lambda*(x-nu*t)):
ball:=(x,y)->pointplot([[x,y]], color=blue, symbol=solidcircle, symbolsize=25):
ani_kurve:=t->plot(g(x,t), x=0..3):
Explore(display(ball(x[fast],g(x[fast],t)), ani_kurve(t), size=[500,200]), t=0...t[max]);

 

 


 

Download Explore.mw

 

If you want to divide both sides of the inequality  e  by  1-a, then you can do so:

d:=a>0,a<1,b>0,c>0;
e:=(1-a)*b>c;
map(`/`, e, 1-a)  assuming d;

                                             

In fact, Maple does not take into account the assumption on  a . See

map(`/`, e, 1-a)  assuming a>1;

                                                                 

If you use  solve  command to solve the inequality, then the assumption is taken into account:

e:=(1-a)*b>c;
solve(e, b)  assuming a<1;
solve(e, b)  assuming a>1;

                                                            

 

sol:=solve([sin(t), 0 < t, t < 8*Pi], t, allsolutions, explicit);
map(rhs@op, [sol]);

 

Addition. This can be written even shorter if we use the element-wise operator ~ (it seems it appeared in Maple 13 or 14):

(rhs@op)~([sol]);
 

 

I took 20 random points in the cylinder:

restart;
P1:=[seq([rand(0...evalf(2*Pi))(),rand(0...2.)(),rand(0...3.)()], i=1..20)]:
P2:=map(t->[t[2]*cos(t[1]),t[2]*sin(t[1]),t[3]], P1):
A:=plottools:-cylinder([0,0,0], 2, 3, style=surface, strips=100, transparency=0.7):
B:=plots:-pointplot3d(P2, symbol=solidsphere, color=red, symbolsize=15):
plots:-display(A, B, axes=none);

                                  

 

 

restart;
myPi_1:=proc(r)
local i,l;
l:=0;
for i from 1 to floor(r) do
    if isprime(i) and (i mod 4 = 1) then
        l:=l+1;
    end if;
end do;
return l;
end proc:    

plot('myPi_1(t)', t = 0 .. 500, numpoints = 500, thickness = 2, color = black);

 

To calculate the values of functions  U1  and  U, it is better to define these functions as procedures and calculate their values for each call of these procedures. Then you will not have any problems:

G1:=-0.9445379894:
f:= (x) -> 0.9/abs(x-0.4)^(1/3)+0.1/abs(x-0.6)^(1/2):
U1 := x->-exp(-x)*(int(f(t)*exp(t), t = 0 .. x)+G1)/2-exp(x)*(int(f(t)*exp(-t), t = 0 .. x)+G1)/2;
seq(U1(x), x=0..1.5, 0.1);
 # Calculations of values the function U1(x)  in the different points
plot(U1, 0..1);  # The plot of U1(x)

 

For a function  U , everything is the same.

lst:=[1,2,3,4,5,6]:
lst[2..5];

                                                        [2, 3, 4, 5]

 

There are no contradictions. The issue that you are plotting the wrong surface for which you want to obtain contours. Should be

f := exp(-r/2)*r^2*cos(2*phi);
plot3d(f, phi = 0..2*Pi, r = 0..15,  coords = cylindrical);
plots:-contourplot(f,  phi = 0..2*Pi, r = 0..15, coords = cylindrical, grid=[100,100]);

                                

Please note where there is a mark 15.

restart;
sol:=dsolve({diff(ca(t), t) = -3.600000000*10^20*exp(-15098.13790/(340-20*ca(t)))*ca(t), ca(0) = 2}, numeric):
f:=x->eval(ca(t), sol(x));
fsolve('f(t)'=0.2);  
# The root
plots:-display(plot(0.2, x=0..5, linestyle=3, color=black),plots:-odeplot(sol,[t,ca(t)], t=0..5, color=red));  # Visual check

                           

 

restart;
a1 := -k*L*(theta-1)*((z-1)*epsilon*delta-epsilon*z+z);
e:=op([-1,1], a1);
subs(e = freeze(e), a1);
applyop(collect, -1, %, z);
b1:=thaw(%);

                            
 

 

n:=4:
R:=Matrix(1,n):
for i from 1 to n do R[1,i]:=unapply(i*x, x);
end do:
R;

 

First 162 163 164 165 166 167 168 Last Page 164 of 292