Kitonum

21530 Reputation

26 Badges

17 years, 86 days

MaplePrimes Activity


These are answers submitted by Kitonum

T:=[alpha0(t)=alpha, beta0(t)=beta,psi[1](t)=psi, theta[1](t)=theta, gamma0(t)=gamma]:

A:=subs(T, eq_liaison):

add(applyrule([cos(u::anything)*cos(v::anything)-sin(u::anything)*sin(v::anything)=cos(u+v), cos(u::anything)*sin(v::anything)+sin(u::anything)*cos(v::anything)=sin(u+v), sin(u::anything)*sin(v::anything)-cos(u::anything)*cos(v::anything)=-cos(u+v), -sin(v::anything)*cos(u::anything)-sin(u::anything)*cos(v::anything)=-sin(u+v)], simplify(coeff(lhs(A),i), size))*i, i={xb[1],yb[1],zb[1],l2[1],l3[1]}):

B:=subs(map(t->rhs(t)=lhs(t),T), %);  # Final result

 

 Addition:

length(B);

                                          753

length(eq_liaison);

                                         1686

 

 

@Kimkimkim  Here is Konigsberg graph with 2 fictitious vertices  a  and  b , created as Carl has offered:

with(GraphTheory):

G:=Graph(Trail(1,2,3,4,1,3),Trail(1,a,2),Trail(1,b,4));

DrawGraph(G, style=planar);

                 

 

 

@Markiyan Hirnyk   This example can be solved much shorter and with greater accuracy:

evalf(Int(exp(-a^3-b), [b=1-a..1+a, a=0..10]));

                     0.3707213163

You can use a caption instead of legend.

Example:

plot3d([(1/2)*x+(1/2)*y, 1+(1/2)*x+(1/2)*y], x = 0 .. 3, y = 0 .. 3, color = [yellow, blue], style = surface, axes = normal, orientation = [-30, 70], caption = "First plane is yellow, second plane is blue", captionfont = [Times, Roman, 14]);

                                 

 

Another variant - you can write the equations of the planes directly on the plot:

restart;

A := plot3d([(1/2)*x+(1/2)*y, 1+(1/2)*x+(1/2)*y], x = 0 .. 3, y = 0 .. 3, color = [green, blue], style = surface, axes = normal, orientation = [-30, 70]):

B := plots[textplot3d]([[3.3, 3.3, 2.5, z = (1/2)*x+(1/2)*y, color = green], [3.3, 3.3, 3.5, z = 1+(1/2)*x+(1/2)*y, color = blue]], font = [Times, Roman, 12]):

plots[display](A, B);

                                

 

Edited.

 

 

 

 

Maple computes the integral right. But if you do not quite trust to Maple, you can do it step by step with a check these steps.

I dropped the constant factors as they do not affect the convergence of the integral. Also, we assume that  t> 0. The integrand in the interval  s=0 .. t  has only one singularity if  s=t. Therefore, we can consider the original integral as the limit of ordinary definite integrals on the range  s=0 .. p  when the variable  p  tends to  t .

A:=int(s^(5/2)/(t^(1/2)-s^(1/2)), s=0..p)  assuming t>0, p>0, p<t;

limit(A, p=t) assuming t>0;

   

 

Validation of calculation of the integral:

int(s^(5/2)/(t^(1/2)-s^(1/2)), s)  assuming t>0, s>0, s<t;

simplify(diff(%, s))  assuming t>0, s>0, s<t;

      

 

 

 

Without  solve - a line as an intersection of 2 planes:

L := [(x-2)*(1/3), (y-1)*(1/4), (z-3)*(1/3)]:

plots[intersectplot](L[1]-L[2], L[2]-L[3], x = -4 .. 4, y = -4 .. 4, z = -4 .. 4, linestyle = 1, thickness = 3, axes = normal, orientation = [60, 75], view = [-1 .. 3, -4 .. 2, -1 .. 4]);

                             

 

 

Addition:  These planes  L[1]-L[2]=0  and  L[2]-L[3]=0  are the projecting planes on the coordinate planes x0y  and  y0z, respectively (the first one is perpendicular to x0y  and the second one is perpendicular to y0z). The equation  L[1]-L[2]=0  in the plane  x0y only, is the projection the original line into the plane  x0y  and  L[2]-L[3]=0  in the plane  y0z only, is the projection the original line into the plane y0z .

For  numeric  option, the parameters must be specified.

This version works for a small range:

restart;

dsys:={diff(u(t),t)=-(N1+M*cos(2*I*omega*t))*u(t)-1+v(t)*exp(-2*I*omega*t)+w(t)*exp(2*I*omega*t), diff(v(t),t)=-(N1+I*Delta-2*M*exp(2*I*omega*t))*v(t)-(N1+u(t))*exp(2*I*omega*t)-2*M, diff(w(t),t)=-(N1-I*Delta-2*M*exp(-2*I*omega*t))*w(t)-(N1+u(t))*exp(-2*I*omega*t)-2*M}:

N1,M,Delta,omega:=1,2,3,4:

res:=dsolve(dsys union {u(0)=-1,v(0)=0,w(0)=0},numeric,output=listprocedure, maxfun=500000);

plots[odeplot](res,[t,Re(w(t))],t=0..5,axes=boxed,color=black,linestyle=1,tickmarks=[3, 4],thickness=2);

 

 Addition:  Setting  maxfun=0  is dangerous if a singularity occurs, as in this case, the program can run forever. I think in your example of just such a situation.

 

LinearAlgebra[ColumnOperation]  command is not suitable to solve your problem.

Here is a short way without any packages:

A:=<1,-1,2,-1; 2,-2,3,-3; 1,1,1,0; 1,-1,4,3>;  # Construction of a matrix

b:=<-8,-20,-2,4>;  # Construction of a vector

A1:=<b | A[..,2..4]>;  # Replacement of the first column of a matrix

                                    

 

 Addition.  More 2 examples:

A2:=<A[..,1] | b | A[..,3..4]>;  # Replacement of the second column of a matrix

A4:=<A[..,1..3] | b >;  # Replacement of the last column of a matrix

                                         

 

 

solid of revolution for  (a) about x=-1:

restart;

with(plots): with(plottools):

ax := spacecurve([-1, t, 0], t = -1 .. 6, color = red, thickness = 2, linestyle = dash):  # Axis of rotation

s1 := animate(plot3d, [[(x+1)*cos(t)-1, x, -(x+1)*sin(t)], x = 0 .. 2, t = 0 .. alpha, style = surface, color = green], alpha = 0 .. 2*Pi, frames = 100):

s2 := animate(plot3d, [[3*cos(t)-1, y, -3*sin(t)], y = 2 .. 5, t = 0 .. alpha, style = surface, color = green], alpha = 0 .. 2*Pi, frames = 100):

s3 := animate(plot3d, [[(x+1)*cos(t)-1, x^2+1, -(x+1)*sin(t)], x = 0 .. 2, t = 0 .. alpha, style = surface, color = green], alpha = 0 .. 2*Pi, frames = 100):

s4 := animate(plot3d, [[cos(t)-1, y, -sin(t)], y = 0 .. 1, t = 0 .. alpha, style = surface, color = green], alpha = 0 .. 2*Pi, frames = 100):

display(ax, seq(s||i, i = 1 .. 4), scaling = constrained, lightmodel = light3, axes = normal, orientation = [60, 70], labels = [x, y, z]);

                     

 

For  revolution  (b) about y=6, everything can be done similarly.

 

 

My procedure is not as elegant as Douglas B. Meade's one, but it does exactly what OP wanted. In addition, it works in older versions Maple in which there is no element-wise operation :

Cat:=proc(S)

local S1;

uses ListTools;

S1:=[Categorize((x,y)->is(x[2]=y[2]), [op(S)])];

{map(t->`if`(nops(t)=1,op(t), [[seq(t[i,1],i=1..nops(t))],t[1,2]]), S1)[]};

end proc:

 

Example :

M10 := {[0,[1,4,2,1]],[1,[2,1,4,2]],[2,[3,6,4,3]],[3,[3,6,4,3]],[4,[4,2,1,4]],[5,[4,3,6,4]],[6,[4,3,6,4]],[7,[5,8,6,5]],[8,[5,8,6,5]],[9,[5,8,6,5]],[10,[6,4,3,6]]}:

Cat(M10);

{[0, [1, 4, 2, 1]], [1, [2, 1, 4, 2]], [4, [4, 2, 1, 4]], [10, [6, 4, 3, 6]], [[2, 3], [3, 6, 4, 3]], [[5, 6], [4, 3, 6, 4]], [[7, 8, 9], [5, 8, 6, 5]]}

 

TheKingDanQc

Unfortunately I did not understand what you wrote. Here are the other 2 ways.

The easiest way to write such a procedure - it's just  to use a ready formula and write it as a procedure-function:

det := A::Matrix -> A[1, 1]*A[2, 2]*A[3, 3] - A[1, 1]*A[2, 3]*A[3, 2] - A[1, 2]*A[2, 1]*A[3, 3] + A[1, 2]*A[2, 3]*A[3, 1] + A[1, 3]*A[2, 1]*A[3, 2] - A[1, 3]*A[2, 2]*A[3, 1] :

 

Example of use:

A := <a1, b1, c1; a2, b2, c2; a3, b3, c3>;

det(A); 

                       

 

The second method uses the definition of the determinant of any 3x3 matrix as the sum of the summands of the form  

sign((j-i)*(k-i)*(k-j))*A[i, 1]*A[j, 2]*A[k, 3]

 taken over all permutations of  {i, j, k} :

 

det1 := proc (A::Matrix)

local S, Rows, i, j, k;

S := 0; Rows := {1, 2, 3};

for i to 3 do

for j in Rows minus {i} do

for k in Rows minus {i, j} do

S := S+sign((j-i)*(k-i)*(k-j))*A[i, 1]*A[j, 2]*A[k, 3]

od; od; od;

S;

end proc:

 

The procedure  det1  is easily generalized to the case of a determinant of order 4, if you add 1 more loop.

The solution easy to get by  fsolve  command if we make a little preparatory work. The system can be reduced to two equations with two unknowns, if we subtract the second equation from the first equation. By  plots[implicitplot]  we find the initial approximations for  T[i]  and  T[r] , and the initial value for  H  we find by solving the first equation:

restart:

T[l]:= 20:

C[p]:= 3779:

rho:= 1026:

nu:= 0.004/60:

P:= 1000:

lign1:= H = 40.09 + 14.774*ln(T[i]-T[l])+(2.28+0.338*ln(T[i]-T[l]))*T[l]:

lign2:= H = -nu*rho*C[p]*ln(1-(T[i]-T[r])/(T[i]-T[l])):

lign3:= P = nu*rho*C[p]*(T[i]-T[r]):

plots[implicitplot]([lign1-lign2, lign3], T[i]=20..50, T[r]=20..50, color=red, thickness=2, gridrefine=3);

fsolve({lign||(1..3)}, {T[i]=30, T[r]=25, H=solve(eval(lign1,T[i]=30))});

                          

 

 

 

An example of using numerical solution:

restart;

dsys := {diff(x(t),t)=y(t),diff(y(t),t)=-x(t),x(0)=1,y(0)=0}:

Sol:=dsolve(dsys,numeric, output=listprocedure);

x:=rhs(Sol[2]);

y:=rhs(Sol[3]);

fsolve(sin(x(t))+x(t)*y(t)^3-0.3=0, t=0..2);  # The solution of a nonlinear equation in a specific range

plot(sin(x(t))+x(t)*y(t)^3-0.3, t=0..2, color=red, thickness=2);  # Visualization

           

 

 

Edited. 

You can exactly to solve your equation  Eq  and then to define the function  U(x,t):

restart;

Eq:=diff(u1(z),z)=9/4*(84*(-z)^(11/2)-8*z^7+540*(-z)^(5/2)+324*z^4-324*z)*u1(z)/((z^2+3*sqrt(-z))*(2*(-z)^(3/2)+3)*(8*z^6+66*(-z)^(9/2)-189*z^3+216*(-z)^(3/2)+81)):

dsolve({Eq, u1(-2)=1});  # Exact solution

assign(%);

u0(z):=z^2/3+sqrt(-z):

U:=unapply(eval(u0(z)+t*u1(z), z=x/t),x,t);

plot(U(x,1), x=-2..0, color=red, thickness=2);  # The plot  U(x,t)  for  t=1

                      

 

 

 

1) You forgot to call  CurveFitting  package. Instead  PolynomialInterpolation  should be  CurveFitting[PolynomialInterpolation]

2) f=-z  is the equation of degree 5 with 2 parameters. Even if there were no parameters, such equations in the general case can not be solved symbolically in terms of its coefficients (in radicals). See  wiki  and  wiki . In the best case, you can solve it numerically (if you specify parameter values).

da := [[1,m],[2,m2],[3,1],[4,2],[5,3],[6,4]];

f := CurveFitting[PolynomialInterpolation](da, z);

solution := solve(f=-z, z);

fsolve(eval(f=-z, [m=1,m2=2]), complex); # Numerical solution for specific values of parameters

              

 

 

 

First 195 196 197 198 199 200 201 Last Page 197 of 290