Kitonum

21840 Reputation

26 Badges

17 years, 225 days

MaplePrimes Activity


These are answers submitted by Kitonum

Here I try to explain why  plots:-implicitplot  command (without special methods like acer' ones) does not work. If I understand correctly, it works simply by calculating the values ​​of the function on the grid without using  fsolve  and the like. If at two points  (x1,y1)  and  (x2,y2)  the continuous function  F(x,y)  takes values ​​of different signs, then at some point of the segment with the ends   (x1,y1)  and  (x2,y2) it is  0 . In the first very simple example below  (x-sqrt(2))^2=0implicitplot  does not plot anything, because there is no change of signs.

Next, we find the domain of the original function  f(b,p) , using the fact that under the roots there are homogeneous functions. As a result, we find that this domain of definition is located between two very close straight lines  p=0.2466777778*b  and  p=0.25*b .

Since the curve  F(b,p)=0  itself is very close to the lower boundary of this domain, if we plot in large enough ranges (for example for  b=0..5, p=0..5) Maple simply skips the area of the sign change, because the grid sizes are much larger. Only if we consider a small rectangle (I took the range  b = 7.95..8.05p = 1.95..2, the plotting is happening (see the bottom 2 graphics) :


 

 plots:-implicitplot((x-sqrt(2))^2, x=0..2, y=0..2);  # Does not work - no change of signs!
fsolve((x-sqrt(2))^2);  # OK

 

1.414213562, 1.414213562

(1)

f:=(b,p)->sqrt(b)*sqrt(1-4*p/b)-2*arctan(sqrt((9*p/b-22201/10000)/(9/4-9*p/b)));

proc (b, p) options operator, arrow; sqrt(b)*sqrt(1-4*p/b)-2*arctan(sqrt((9*p/b-22201/10000)/(9/4-9*p/b))) end proc

(2)

evalf(solve({subs(p=k*b,1-4*p/b)>=0,subs(p=k*b,(9*p/b-22201/10000)/(9/4-9*p/b))>=0})); # The domain of the function f between 2 lines p=.2466777778*b  and  p=0.25*b

{.2466777778 <= k, k < .2500000000}

(3)

RealRange(.2466777778, Open(.2500000000))

(4)

# Below all the plottings on the fine grid (gridrefine=3) near the point (8,2)
 plots:-implicitplot(sqrt(b)*sqrt(1-4*p/b)-2*arctan(sqrt((9*p/b-22201/10000)/(9/4-9*p/b))) = 0, b = 7.95..8.05,
 p = 1.95..2, color=red, gridrefine=3, view=[7.95..8.05,1.95..2] );
 plots:-implicitplot(sqrt(b)*sqrt(1-4*p/b)-2*arctan(sqrt((9*p/b-22201/10000)/(9/4-9*p/b))) = 0, b = 7.95..8.05,
 p = 1.95..2,  color=red, gridrefine = 3, rational, view=[7.95..8.05,1.95..2]);

 

 

 


 

Download Plottings.mw

 

Here is another method based on applying  extrema  command and simplifying the result by  rationalize  and  simplify  commands:

restart;
f:=x->(cos(x)+sqrt(3)*sin(x))/(cos(x)+sin(x)+2);
convert(extrema(f(x), {}, x), list);
Min, Max:=simplify(rationalize(%))[];
evalf([Min,Max]);

Output:

    

 

 

You assigned  o8:=0  and  o8  stands in the denominators.

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

First 118 119 120 121 122 123 124 Last Page 120 of 292