Kitonum

21565 Reputation

26 Badges

17 years, 138 days

MaplePrimes Activity


These are answers submitted by Kitonum

I think that for all symbolic computation of multiple integrals basic  int  command is called.
At first I tried to calculate this integral using  int  command as iterated integral in 2 ways:

int(2*x+2*y+2*z, [z=-sqrt(1-(1/4)*x^2-(1/4)*y^2)+1 .. sqrt(1-(1/4)*x^2-(1/4)*y^2)+1, y=-sqrt(-x^2+4) .. sqrt(-x^2+4), x=-2..2]);    # The first way

int(int(int(2*x+2*y+2*z, z=-sqrt(1-(1/4)*x^2-(1/4)*y^2)+1 .. sqrt(1-(1/4)*x^2-(1/4)*y^2)+1), y=-sqrt(-x^2+4) .. sqrt(-x^2+4)), x=-2..2);    # The second way of the same

                                                  

In the first way, the result is right, in the second -  incorrect. Probably the difference is that in the first way, the restriction   x=-2..2  is taken into account from the outset.

To find out at which step in the second method error occurs, I did all the steps of calculating:

restart;

Int1 := expand(int(2*x+2*y+2*z, z = -sqrt(1-(1/4)*x^2-(1/4)*y^2)+1 .. sqrt(1-(1/4)*x^2-(1/4)*y^2)+1));

Int2 := int(Int1, y = -sqrt(-x^2+4) .. sqrt(-x^2+4));  # Incorrect result  

Int3 := int(Int1, y = -sqrt(-x^2+4) .. sqrt(-x^2+4))  assuming x >= -2, x <= 2;  # Correct result  

int(Int2, x = -2 .. 2);

int(Int3, x = -2 .. 2);

                       

 

Obviously integral  Int2  calculated incorrectly.

 

Conclusion: more reliably to calculate multiple integrals symbolically by syntax

int(f(x,y,z), [z=..., y=..., x=...])  if iterated integral are calculated in that order. 

restart;

X:=l1*cos(theta1)+l2*cos(theta1+theta2)=x:

Y:=l1*sin(theta1)+l2*sin(theta1+theta2)=y:

S:=solve({X, Y}, {theta1,theta2}):

simplify([allvalues(eval(S, {l1=5, l2=5, x=5, y=3}))]);  # Symbolic solution

evalf(%);  # Numeric solution (angles in radians)

 

Your equation is singular at the  r=0  of the factor  1/r. The equation was solved numerically for specific values of the parameters and replacement  0  by the small number  0.0001 .

restart;

n := 1: Nu := 4:

eq := diff(T(r), r, r)+(diff(T(r), r))/r+(3*n+1)*Nu*(1-r^((n+1)/n))*T(r)/(n+1) = 0;

bc := T(1) = 0, D(T)(0.0001) = 1;

Sol := dsolve({eq, bc}, T(r), numeric, maxmesh = 2056, abserr = 10^(-3));

plots[odeplot](Sol, [r, T(r)], r = 0.0001 .. 1);

 

 

You can not use the name  I[b], because  I  is the protected constant (imaginary unit). So I[b] replaced with .

Example:

M:=<1,2; 2,3>;  Q:=<-2,3; 1,5>;

Q^(%T).M.Q;

IsMatrixShape(%,symmetric);

                   

Maybe  OrthogonalExpansion  package help you. It  can be downloaded from 

http://www.maplesoft.com/applications/view.aspx?SID=33406

menu Tools -> Options -> Display -> Uncheck "Automatically display legends in 2-D plots"

simplify(conjugate(exp(I*x)))  assuming x::real;

Your example:

X:=[1,2]:

Y:=[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]]:

Z:=[[20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49], [21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]]:

plots[surfdata]([seq([seq([X[i],Y[i,j],Z[i,j]],j=1..nops(Y[i]))], i=1..nops(X))], axes=normal, view=[-0.5..2.5,-0.5..30.5,-0.5..50.5], orientation=[-40,70], labels=[x,y,z]);

                         

 

 

decToBin:=proc(n::integer)

if n<0 then return NULL fi;

decToBin(0):=0;

if n>0 then decToBin(n):=parse(cat(decToBin(iquo(n,2)), irem(n,2)))  fi;

end proc:

 

Examples of use:

decToBin(10);  decToBin(163);  decToBin(-1);  decToBin(A);

restart;

f:=n->2*(1-n)/3:

k:=0: V:=Vector():

for i from -5 to 5 do

if type(f(i), integer) then k:=k+1;  V(k):=f(i)  fi;

od:

V;

                          

 

 

I also do not understand why you introduce vectors, if at the beginning of your worksheet the partition is defined through lists. So I replaced vectors with the lists.

The following code on each call returns a random partition of  the number  n :

 

Partition := proc (n::posint)

local i, Integer, Sum, Partition;

Sum := 0; Partition := [ ];

for i to n-1 do

if Sum < n then Integer := RandomTools[Generate](integer(range = 1 .. n));

if Sum+Integer <= n then Partition := [op(Partition), Integer];

Sum := Sum+Integer end if end if;

end do;

`if`(Sum < n, sort([op(Partition), n-Sum]), sort(Partition));

end proc:

 

Example of use (the procedure was called 100 times):

seq(Partition(5), i = 1 .. 100);

 

 

If I understand the problem, we need to find the point at which the different curves merge. Absolutely they never merge, just very close to each other. Therefore, we set the boundary proximity  epsilon , when we think that the curves are indistinguishable. In the example below, we find  T , when the black curve merges with the red curve, setting  epsilon=0.001

restart;

Eq := x-(r+3.1*10^7*exp(-11616/(1.98*T)))/(3.1*10^7*exp(-11616/(1.98*T))+1.8*10^18*exp(-29691/(1.98*T))) = 0:

x:=unapply(rhs(isolate(Eq, x)),T,r); # is the function of  (T,r)

 R := [0, 0.1e-2, 0.1e-1, .1, 1.6]:

simplify(diff(x(T,R[5])-x(T,R[1]),T)); # Derivative is negative, thus graphs approach each other

epsilon:=0.001;

T0:=fsolve(x(T,R[5])-x(T,R[4])=epsilon); # From this value   the distance between the graphs is less than epsilon

plots[implicitplot]([seq(eval(Eq, r = R[i]), i = 1 .. nops(R))], T = 0 .. 500, x = 0 .. 2, color = [red, blue, green, yellow, black,red], thickness=[2,1$4], gridrefine = 5);

                     

                        

 

 

If your expression is a polynomial in  t, then just

expr:=0.5*t^5 * r^(-1)*V:

degree(expr, t);

                           5

 

The procedure  for more complex expressions, not only for the polynomials:

power:=proc(expr, x)  # procedure finds the maximum degree of subexpressions x^n::integer in the expression expr

local S, L, s, n;

S:=indets(expr,`^`);

L:=[];

for s in S do

n:=op(s)[2];

if op(s)[1]=x and n::integer then L:=[op(L), n] fi;

od;

max(L);

end proc:

 

Another variant - the same in Carl's style:

power:=(expr::algebraic, t::name)->max(map(s->op(s)[2], select(s->(op(s)[1]=t

and op(s)[2]::integer), indets(expr,`^`)))):

 

 

Example of use:

power(sin(t^2)+1/(1+t^3)+2^t, t);

                            3

 

My answer was edited and expanded.

@Daniel Maxin  You can use  listcontplot  command, but for this you have to rewrite your data so that it was a two-dimensional list consisting only of the  z-values corresponding to the points  (x[i], y[j]), taking by "layers". There is another problem. Maple draws the contour curves with the marks on the coordinate axes are not real values  (x[i], y[j]), and their numbers  i=1..m, j=1..n . This problem can be easily solved using a linear transformation which is the compression to the point  (1, 1), then the parallel translation.

For example, I took the values  (x[i], y[j])   in the rectangle  x=1..4  and  y=2..4  with step  0.2. Third coordinate z for these points I took by formula  z=x^2+y^2 . So I got the list  Data . Then  plots[listcontplot]  command for  Data . The color intensity increases from pink to red with increasing  z-values. Default Maple draws 8 contour lines. Their numbers and values you can adjust by levels  option.

X:=[seq(x, x=1..4, 0.2)];

Y:=[seq(y, y=2..4, 0.2)]; 

Data:=[seq([seq(x^2+y^2, x=X)], y=Y)];

P:=plots[listcontplot](Data, filledregions=true, coloring=[pink,red]):

P1:=plottools[translate](plottools[homothety](P, 1/5, [1,1]), 0, 1):

plots[display](P1, view=[-0.5..5,-0.5..5]); 

 

                           

 

 

First 216 217 218 219 220 221 222 Last Page 218 of 290