Kitonum

21460 Reputation

26 Badges

17 years, 47 days

MaplePrimes Activity


These are answers submitted by Kitonum

In Maple 2018 everything is the same.
Do not use  simplify  command, but just differentiate:

with(Physics):
Setup(noncommutativeprefix={P,Q});
diff(Q(t)^2*P(t)*Q(t) + Q(t)*P(t)*Q(t)^2, t);

Output:

          

Replace  e^(c*v)  by  exp(c*v) . e  is just a symbol in Maple.

This works:

restart:
with(Statistics): 
X := Vector([1, 2, 3, 4, 5, 6], datatype = float):
Y := Vector([2.2, 3, 4.8, 10.2, 24.5, 75.0], datatype = float): 
NonlinearFit(a+b*v+exp(c*v), X, Y, v);

sqrt(sqrt(p^2+1)-1)*sqrt(sqrt(p^2+1)+1);
simplify(combine(%)) assuming positive;


Here is another rather effective method of simplifying expressions containing radicals. Since this expression itself (we denote it by  ) is obviously positive for any real  p , it is equal to the square root of its square   A=sqrt(A^2) . Therefore, we first square it, then simplify and extract the square root:

A:=sqrt(sqrt(p^2+1)-1)*sqrt(sqrt(p^2+1)+1);
sqrt(simplify(A^2))  assuming p>0;
                         

  Edit.  

If you define a matrix or an array, you should specify ranges for the indexes and just specify non-zero elements. The rest of the elements are automatically considered zeros. 

Your example:

H:=Array((1..3)$4, {(1,1,1,1)= value1, (1,2,2,1) = value2, ...});


See help on  Matrix  and  Array  commands for details.

expr:=``(-y^2+1);
abs(expr);
expand(op(1,%));

restart;
expr := 7*ln(arcsin(x))-(1/2)*ln(x-1)*sin(x)-(1/2)*ln(x+1)+f;
applyrule(ln(t::anything)=ln(abs(t)), expr);


Addition.  Such a calculation may cause a problem due to premature calculation. In this case, you can act as in the example below:

restart;
expr := ''7*ln(arcsin(x))-(1/2)*ln(x-1)*sin(x)-(1/2)*ln(x+1)+f+ln(-2)+ln(-exp(1))'';
applyrule(ln(t::anything)=ln(abs(t)), expr);

Should be  plots:-display  instead of  plot:-display  or  display .  Also should be  plottools:-line  instead of  line .Also  sigma1P1sigma2P1tau12P1  are not defined. Submit the complete code if you want a more complete answer.

See:
L[1]:=1:  L[2]:=2:
L; 
                                 
              L

Unfortunately in Maple there is no command that allows to find the set of values of some function (from one or several variables). But there is a rather simple workaround. Using  maximize  and  minimize  commands, we can solve the problem. It remains to apply the property of a continuous function defined on a connected and compact set: if at two points  x1  and  x2  the function takes certain values  m  and  M  (M>m), then for any intermediate number  m<c<M  there is a point  x0  at which the function takes the value  c .

For the function  (R,z)->R-sqrt(R^2+z^2)  we have:

maximize(R-sqrt(R^2+z^2));
minimize(R-sqrt(R^2+z^2));
                                                       
 0
                                                     -infinity


Therefore, we can conclude that a given function can take any values <=0 .

 


 

restart

VectorCalculus[SetCoordinates]('cartesian'[x, y, z]); F := x, y, z, t

vel := VectorCalculus[VectorField](`<,>`(u(F), v(F), w(F))); V := VectorCalculus[VectorField](rho(F)*vel)

Vector(3, {(1) = u(x, y, z, t), (2) = v(x, y, z, t), (3) = w(x, y, z, t)})

 

Vector(3, {(1) = rho(x, y, z, t)*u(x, y, z, t), (2) = rho(x, y, z, t)*v(x, y, z, t), (3) = rho(x, y, z, t)*w(x, y, z, t)})

(1)

Mass_eqn := diff(rho(F), t)+VectorCalculus[Divergence](V)

diff(rho(x, y, z, t), t)+(diff(rho(x, y, z, t), x))*u(x, y, z, t)+rho(x, y, z, t)*(diff(u(x, y, z, t), x))+(diff(rho(x, y, z, t), y))*v(x, y, z, t)+rho(x, y, z, t)*(diff(v(x, y, z, t), y))+(diff(rho(x, y, z, t), z))*w(x, y, z, t)+rho(x, y, z, t)*(diff(w(x, y, z, t), z))

(2)

``


 

Download aero_new.mw

Here is a procedure that does the desired for both constant complex numbers and numbers containing parameters, assuming that these parameters are real numbers. To find the polar angle, the built-in two-argument function arctan(b,a)  was used. This function returns the polar angle for the point  (a,b)  in the range  -Pi .. Pi:

restart;
ExponentialForm:=proc(z)
local Z, a, b;
Z:=evalc(z);
a,b:=Re(Z),Im(Z) assuming real; 
``(simplify(sqrt(a^2+b^2)))*exp(``(simplify(arctan(b,a)))*I) assuming real;
end proc:


Examples of use:

ExponentialForm(1+1*I);
ExponentialForm(1-sqrt(2));
ExponentialForm(exp(I*3*x-x/2)/(1+I));
                      
   

Here is another version of the same procedure in which the multiplication symbol is explicitly displayed as a bold dot: 

ExponentialForm1:=proc(z)
local Z, a, b, c;
Z:=evalc(z);
a,b:=Re(Z),Im(Z) assuming real; 
subs(`%*`=`.`,simplify(sqrt(a^2+b^2))%*exp(simplify(arctan(b,a))%*I)) assuming real;
end proc:


Example:

ExponentialForm1((1+I)^37);
expand(%);
       


Edit. 

It's just the length of the gradient vector of a scalar function  u(x,y) . Formally, this can be calculated using Student:-VectorCalculus package:

with(Student:-VectorCalculus):
V:=Del(u(x,y));
a:=DotProduct(V,V);
n:=V/sqrt(a);
simplify(DotProduct(n,V));


Addition. For calculation at a specific point it is convenient to use the differentiation operator  D .

Example:
restart;
u:=(x,y)->x^2+y^2;
x0:=1: y0:=2:
sqrt(D[1](u)(x0,y0)^2+D[2](u)(x0,y0)^2);


 

In addition to the unknown  S , your equation contains 2 parameters  epsilon  and  a . To solve the equation, you must specify numerical values for these parameters.

Example:


 

restart; Eq := -3*Pi^2*3^(2/3)*4^(1/3)*S^3*(epsilon/Pi)^(2/3)+16*a*(S/Pi)^(3/2)*Pi^5+24*S^4*Pi = 0; Student:-Calculus1:-Roots(eval(lhs(Eq), [epsilon = 1, a = -2]), S); plot(eval(lhs(Eq), [epsilon = 1, a = -2]), S = 0 .. 5)

-3*Pi^2*3^(2/3)*4^(1/3)*S^3*(epsilon/Pi)^(2/3)+16*a*(S/Pi)^(3/2)*Pi^5+24*S^4*Pi = 0

 

Warning, some roots are returned as numeric approximations

 

[0, 3.779233961]

 

 

 


 

Download rootof_new.mw

I can not confirm this result. Everything is working properly on my computer (Maple 2018 on Windows 10):

restart;
g:=x->int(exp(-2*t^2), t=x-1..x)-int(exp(-2*t^2), t=x..x+1);
g(1);
evalf(%);
G:=x->Int(exp(-2*t^2), t=x-1..x)-Int(exp(-2*t^2), t=x..x+1);
evalf(G(1));
                           

Your code has not only syntax errors, as it was mentioned above. The main error is the selection of sub-intervals. The function has a root in some interval if two conditions are fulfilled: the function is continuous in this interval and at the ends of the interval takes values of different signs. Therefore, at the very beginning, it is necessary to check these conditions, and then, when selecting the sub-intervals, check the second condition.

Bisection := proc(f::procedure, a::realcons, b::realcons, delta::realcons)
local S, s, startpoint, endpoint, midpoint;
S:=discont(f(x), x);
if nops(S)<>0 then
for s in S do
if is(s>=a) and is(s<=b) then error "f(x) should be continuous in the range a..b" fi; 
od;
fi;
if is(abs(f(a))<delta) then return a fi;
if is(abs(f(b))<delta) then return b fi;
if is(f(a)*f(b)>0) then error "Should be f(a)*f(b)<=0" fi; 
startpoint := a; endpoint := b;
do midpoint := (startpoint+endpoint)/2;
if is(abs(startpoint-endpoint)<delta) or is(abs(f(midpoint))<delta) then
return evalf(midpoint)
elif is(f(midpoint)*f(startpoint)<0) then endpoint := midpoint
else startpoint := midpoint fi;
od;
end proc:


Examples of use:

Bisection (x->1/x , -1, 2, 0.00001);
Bisection (x->1/x, 1, 2, 0.00001);
Bisection (x-> 1/x-0.7 , 1, 2, 0.00001 );


is command is used to exclude situations like

if Pi<4 then 1 else 0 fi;
Error, cannot determine if this expression is true or false: Pi < 4
 

We can find the value of the second integral if we replace two subexpressions (for a time), that are not dependent on beta by names, using  freeze  and  thaw  commands:

Download INTEGRAL2_new.mw

First 116 117 118 119 120 121 122 Last Page 118 of 290