Kitonum

21440 Reputation

26 Badges

17 years, 34 days

MaplePrimes Activity


These are answers submitted by Kitonum

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

restart;
Z:=Vector[row](5, {(1) = z, (2) = z-2, (3) = z-4, (4) = z-6, (5) = z-8}):
k:=4:
Test := proc()
local i, j; 
global CC, Testna, Z, k:
for i from 1 to 3 do 
for j from 1 to 3 do
CC[i,j] := add(Testna[i,j+(n-1)*3]*(Z[n]-Z[n+1]), n=1..k);
end do;
end do;
Matrix(3, (i,j)->CC[i,j]);
end proc:


Example of use:

interface(rtablesize=infinity):
Testna := LinearAlgebra:-RandomMatrix(3, 12);
Test();

You can easily do this with a simple procedure with two formal parameters: one of them is a numerical constant, and the other is a certain range:

P:=proc(a::{numeric,range}, b::{numeric,range})
uses plots;
if a::numeric then
animate( plot, [a*sin(B*x), x=0..10, scaling=constrained], B=b, size=[1000,400]) else
animate( plot, [A*sin(b*x), x=0..10, scaling=constrained], A=a, size=[1000,400]) fi;
end proc:


Examples of use:

P(0.5, 1..2);
P(1..2, 0.5);

 

For a single use you can use single quotes around the external  diff  to get a delayed calculation:

restart;
eq:=1/r*'diff'(r*diff(f(r), r), r);
                                 


On a subsequent call,  eq  will be calculated.

Use  Explore  command for this.

Example:

Explore(plot(a*sin(b*x+c),x=0..2*Pi, scaling=constrained, view=[0..2*Pi,-2..2]), parameters=[a=0.5..2, b=0.5..2, c=0..Pi/2]); 

 

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