Kitonum

21550 Reputation

26 Badges

17 years, 125 days

MaplePrimes Activity


These are answers submitted by Kitonum

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]); 

 

                           

 

 

In older versions of Maple in which there is no  parametric  option, it is useful to factorize the polynomial , then the solution is reduced to the study of the discriminant of quadratic trinomial:

factor(b^4-(2-d)*b^2-2*d*b+1+d);

discrim(op(2, %), b);

                                   

Because  for  d>0  the discriminant  of  b^2+2*b+d+1  is negative, then  b^4-(2-d)*b^2-2*d*b+1+d>0  for all  b<>1 .  So should be solved in this way, if you need a manual solution.

 

For automated solution you can simply write

solve(b^4-(2-d)*b^2-2*d*b+1+d > 0, b) assuming d > 0, d <= 1;

                   

 

 

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