Kitonum

21530 Reputation

26 Badges

17 years, 85 days

MaplePrimes Activity


These are answers submitted by Kitonum

1) Probably for input of indexed variables you used the second of the two options in the palette "Expression" of Maple 2015. Under this Maple considers 1 as a symbol, and not as an integer. Therefore, use the left variant or type  x[1] .

In example the left x[1] was typed as yours (see output (18)):

 

2) In your formula (7) there is a premature calculation. As a workaround use quotes:

        

 

 Correction: If you properly inputted indexed  variables, you can not use quotation marks, because when setting a function by an arrow the calculation  occurs at call:

          

 Here is the file:

Question1.mw

 

What are you going to calculate, called the directional derivative. The direction vector must be specified as a list whose number of elements must equal the number of variables, that is 3, and the elements of this vector should be numbers or symbols that are not dependent on x, y, z .

Example:

restart;

with(Student[MultivariateCalculus]):

f:= x*y*z + 3*x^2*y*z;

v:= [a, b, c];

DirectionalDerivative(f, [x,y,z], v );

          

 

 

See help on  DirectionalDerivative  command

nops  command  returns the number of members of the sequence (the number of operands of the first level) after the command op   .

See

op(10*x^2);  # operands of the first level

                     10,  x^2

 

See the help on  op  and  nops  commands.

 

restart;
f:=exp(-I*Im(s)*(t));  # I is iota, s is a complex number and t is time.

evalc(f) assuming s::complex, t::realcons;

                           cos(Im(s)*t)-I*sin(Im(s)*t)

 

In Maple  I  is the imaginary unit.

Perhaps this example will help you:

 

eliminate({x^3+3*y^2=7, x^4-y^5=1}, y);

[{y = -(9*x^4-9)/(-x^6+14*x^3-49)}, {x^15-35*x^12+490*x^9+243*x^8-3430*x^6-486*x^4+12005*x^3-16564}]

 

sol := solve([x-y = 10, x+y < 100], [x,y]);

[convert(convert(op(sol)[1],RealRange),relation), op(sol)[2]];  # All solutions

                                              sol := [[x < 55, y = x-10]]

                                      [And(-infinity <= x,x < 55), y = x-10]

 

The variable x  in   [And(-infinity <= x,x < 55), y = x-10]  serves as a parameter.

 

 Addition:  Geometrically the set of all the solutions of your system  is a ray (half-line):

plot([x,x-10, x=-10..55], color=red, thickness=3, view=[-10..65, -20..55]);

                       

 

 

B:=proc(m,n)

if n=1 then B(m,n):=omega(m) else 

B(m,n):=add(omega(j)*B(m-j,n-1),j=1..m-1)

end if;

end proc:

 

Examples of use:

B(1,1),  B(2,1),  B(3,2),  B(2,3);

               omega(1), omega(2), 2*omega(1)*omega(2), 0

 

Edit.  sum  command has been replaced by  add  command.

Or use exact arithmetic:

restart;

t0 := 2000:  P0 := 100:  m := 9/50:

dsolve({P(t0) = P0, diff(P(t), t) = b*P(t)+m*t});

P := unapply(rhs(%), t);

fsolve(P(2001) = 2*P0);

plot(eval(P(t), b = convert(%, fraction)), t = 2000 .. 2001);

           

 

 

 

Add to your equation additional equation  diff(x(t),t,t)=y(t)  and another initial condition that is easy to find from the original equation.

An example:

sol:=dsolve({diff(x(t),t,t)-diff(x(t),t)=1+t^2+x(t)^(3/2), diff(x(t),t,t)=y(t), x(0)=0, y(0)=1, D(x)(0)=0}, numeric):

 

Use of  sol :

sol(0.5);

x:=t->rhs(sol(t)[2]):

D(x):=t->rhs(sol(t)[3]):

(D@@2)(x):=t->rhs(sol(t)[4]):

x(0.5),  D(x)(0.5),  (D@@2)(x)(0.5);

 

 

 

Maple 2015.1 automatically sorts as you want:

f[1]:=[1,3,2]:

f[2]:=[2,1,3]:

f[3]:=[1,2,3]:

f[4]:=[2,3,1]:

f[5]:=[3,2,1]:

f[6]:=[3,1,2]:

sort([seq(f[i], i=1..6)]);

                     [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]

If you need many times  use the components of your inequalities, you can define the new functions:

h:=(s,t)->f(s,g(s,t))+f(g(s,t),t):  

p:=(s,t)->f(g(s,t),g(s,t)):  

q:=(s,t)->f(s, g(s,t)):  

u:=(s,t)->f(g(s,t),t):  

w:=(s,t)->g(f(s,t), t):

 

Then the inequalities can be written more compactly:

h(x,y)>=p(x,y);

2*q(x,y)>=u(x,y);

2*q(x,y)>= w(x,y);

q(x,y)^2>=u(x,y);

       

 

 

 

 

 

You operate with matrices whose elements are also matrices. When you multiply these objects, Maple does not understand that the individual elements of these objects should also be multiplied as matrices. Workaroud is that probably you should write this multiplication explicitly

See an example and a workaround:

A:=Matrix(2,{(1,1)=Matrix([[1,2],[3,0]]),(1,2)=Matrix([[-1,0],[1,3]]),(2,1)=Matrix([[1,2],[4,0]]),(2,2)=Matrix([[-1,0],[1,5]])});

B:=A^2;  # Maple does not know what to do next

B1:=Matrix(2, (i,j)->add(A[i,p].A[p,j],p=1..2));  # A workaround

 

 

 

restart;

Exponents1:= proc(p, x::name)

 local L, k, i, j;

k:=0:

for i in op(p) do

for j in op(i) do

if has(j,x) then k:=k+1; if nops([op(j)])=1 then L[k]:=1 else L[k]:=op(2,j) fi; fi;

od; od;    

convert(L, list);

end proc:

 

Your example:

f:=5*A^4*B^3*C^7+3*A^2*B^1*C^7+31*A^3*B^6*C^11;

Exponents1(f,A);       

Exponents1(f,B);

Exponents1(f,C);       

        

 

 

 Addition.

Unfortunately Maple  (Maple 2015.1) does not preserve the order of terms in the polynomial. If you want the order  of the exponents has been saved, you can specify the polynomial as a list of its terms, as follows

f:=[5*A^4*B^3*C^7, 3*A^2*B^1*C^7, 31*A^3*B^6*C^11];

Procedure code remains unchanged.

 

Another addition. 

I read the acer's solution and noticed that my solution is not working properly, if the polynomial consists of a single term. I did not bother to correct my solution as acer's solution easier and more understandable.

restart;

SplitScan1:= proc(f, L::list)

local M, m;

M:=[seq(`if`(f(L[i],L[i+1]), i, NULL), i=1..nops(L)-1)];  # List of positions of L in which it must be split

m:=nops(M);        

[L[..M[1]], seq(L[M[k]+1..M[k+1]], k=1..m-1), L[M[m]+1..]];

end proc:

 

The procedure is easy to modify if you want to find not the whole split list L, but some of its sub-lists, because the all information about the positions of split is in the pre-calculated list M. This can save a lot of time if the list  L  is long.

I fixed a few syntax errors in your code. 

ode := diff(y(x), x, x, x)+2*(diff(y(x), x, x))/x+2*(diff(y(x), x))/x^2-(25/8)*x^2*(7*x^10+52*x^5+16)*y(x)^7 = 0;

sol := dsolve({ode, y(0) = 1, (D(y))(0) = 0, ((D@@2)(y))(0) = 0}, numeric);

plots[odeplot](sol, [x, y(x)], x = 0 .. 1);

 

 

First 207 208 209 210 211 212 213 Last Page 209 of 290