Kitonum

21500 Reputation

26 Badges

17 years, 60 days

MaplePrimes Activity


These are answers submitted by Kitonum

First we find the point  x0  in the range  [1, 2]  in which the derivative is 0. To check the type of the point  x0 , we find the 2nd derivative. Since the second derivative turned out to be negative in the point  x0 , we conclude that at the point  x0  we have a local maximum. The graph of the function confirms the result:

f := x->2*sin(x^2/2)-sin(x/2)^2;
x0:=fsolve(D(f)(x)=0, x=1..2);
(D@@2)(f)(x0);
plot(f, 1..2); 

 

Use the  select  command for this.

Examples for a vector and a list:

select(t->t>=10 and t<=30, <20, 133, 2 + 3*I, 15, 3 + 3*I>);
select(t->t>=10 and t<=30, [20, 133, 2 + 3*I, 15, 3 + 3*I]);

 

 

If we assume that your conditions

{f(r, 0, t) = 1, f(r, z, 0) = 0, (D[1](f))(r, L, t) = 0, f(Ri, z, t) = 0}

are true for any values of variables, then such a function does not exist, because from the first two conditions we have  f(r, 0, 0) = 1  and  f(r, 0, 0) = 0

If the conditions are slightly weaken, it is easy to choose the appropriate piecewise function ( g(r,z,t)  is an arbitrary function of three variables):

 

 

 

restart;
Ri := 1: L := 1:
f := unapply(piecewise(z = 0, 1, z <> 0, (r-Ri)*(z-L)*g(r, z, t)), r, z, t);

f := proc (r, z, t) options operator, arrow; piecewise(z = 0, 1, z <> 0, (r-1)*(z-1)*g(r, z, t)) end proc

(1)

is(f(r, 0, t) = 1);
is(f(1, z, t) = 0) assuming z<>0;
is((D[1](f))(r, L, t) = 0);
is(f(Ri, z, t) = 0) assuming z<>0;

true

 

true

 

true

 

true

(2)

 

 

 

Download function.mw

Edit.

You have a complex-valued function of two variables  x  and  t . You can plot real and imaginary parts as 2 surfaces:

plot3d([(Re,Im)((1+cosh(2*x))*exp(-4*I*t))], x=0..1, t=0..1, color=[red,blue]);

                          

 You can easily perform this calculation in Maple, if you use a well-known formula for the residue at the pole of order  m :

restart;
f := exp(-z/A)/z^(2 + n);
m:=2+n;
1/(m-1)!*limit(diff(z^m*f,z$(m-1)), z=0);
(2*Pi*I)*%;

 

Use  piecewise  command to specify such functions.:

f(x):=piecewise(-1 <= x and x <=3.5, (x + 1)*(x - 1)*(x - 3), -3 <=x and x<=-1, -2*(x + 1)*(x + 2.5));
plot(f(x), x=-3..3.5, -4..5, color=blue, thickness=2, size=[600,500]);

               

 

Use these options:


 

restart; with(plots)

fcns := {f(eta), g(eta), t(eta)}

N := 1; k1 := 5; nb := .3; nt := .3; pr := 5; sc := 1

eq1 := diff(f(eta), `$`(eta, 3))+(1/2)*f(eta)*(diff(f(eta), `$`(eta, 2)))+k1*((diff(f(eta), `$`(eta, 1)))*(diff(f(eta), `$`(eta, 3)))-(1/2)*f(eta)*(diff(f(eta), `$`(eta, 4)))+(1/2)*(diff(f(eta), `$`(eta, 2)))^2) = 0; eq2 := diff(t(eta), `$`(eta, 2))+pr*nb*(diff(t(eta), `$`(eta, 1)))*(diff(g(eta), `$`(eta, 1)))+pr*nt*(diff(t(eta), `$`(eta, 1)))^2+(1/2)*f(eta)*(diff(t(eta), `$`(eta, 1))) = 0; eq3 := diff(g(eta), `$`(eta, 2))+nt*(diff(t(eta), `$`(eta, 2)))/nb+(1/2)*f(eta)*(diff(g(eta), `$`(eta, 1)))*sc/pr = 0

bc := f(0) = 0, (D(f))(0) = 0, (D(f))(N) = 1, ((D@@2)(f))(N) = 0, t(0) = 1, t(N) = 0, g(0) = 1, g(N) = 0

R := dsolve(eval({bc, eq1, eq2, eq3}), fcns, type = numeric, method = bvp[midrich], maxmesh = 1000, abserr = 10^(-4))

p1u := odeplot(R, [eta, (D(f))(eta)], 0 .. N, numpoints = 100, labels = ["&eta;", "f'"], linestyle = solid, color = [blue], thickness = 1, labeldirections = [horizontal, vertical], labelfont = ['TIMES', 'BOLDOBLIQUE', 16])

p1u

 

``


 

Download bvp_new.mw

A:=plot(eval(R*cos(omega*t),[R=2,omega=1]), t=0..4*Pi, color=black, tickmarks=[[seq(2*Pi*k=2*k*Pi/omega,k=0..2)],[seq(2*k=k*R,k=-1..1)]], scaling=constrained, size=[800,300], axesfont=[times,16], view=[-0.7..4*Pi+1.5,-2.2..2.5],labels=[``,``]):
B:=plots:-textplot([[1.3,2.5,x=R*cos(omega*t)],[4*Pi+1.5,-0.2,t]], font=[times,16]):
C1:=plots:-arrow([0,2.35],[0,0.15], head_length=0.15,head_width=0.07):
C2:=plots:-arrow([4*Pi+1.35,0],[0.15,0], head_length=0.15,head_width=0.07):
plots:-display(A,B,C1,C2);

       


Of course, for any plottings, all parameters must be specified, but the inscriptions on the plot you can specify any you wish, using tickmarks , plots:-textplot , labels  and so on. 

I think it’s important not only to get a formal solution, but also to understand why the solution is unique. In this example, we have an underdetermined system (two equations with 3 unknowns) and, for example, the  fsolve  command refuses to solve such systems at all. Let's approach the problem from a geometric point of view: to find the intersection of two surfaces in 3D, given by its equations. It is easy to verify that the first surface is a sphere with a radius of 5. The second equation is a plane. We find the distance from the center of the sphere to the plane and see that it is equal to the radius of this sphere. So the plane touches the sphere, and we find the point of tangency simply by projecting the center of the sphere onto this plane:

restart;
Eq1, Eq2 := x^2+y^2+z^2-4*x+6*y-2*z-11 = 0, 2*x+2*y-z = -18:
Student:-Precalculus:-CompleteSquare(Eq1, [x,y,z]);
with(geom3d):
point(o,2,-3,1):
plane(P,Eq2, [x,y,z]):
distance(o, P);
projection(p, o, P):
detail(p);

          

 

In most cases, the results are the same. However, eval is a more "intelligent" command. For example, when calculating derivatives or integrals, eval works correctly, but subs does not.

Examples:

eval(int(f(x),x=0..x),x=1);
subs(x=1,int(f(x),x=0..x));
eval(diff(f(x),x), x=1);
subs(x=1,diff(f(x),x));


See help on these command for details.

restart;
a := <3, 4, 5>;
Explore(a(i), i = 1 .. 3);


Here we used a functional notation (arguments of functions in parenthesis).

restart;
for i from 50 by 5 to 85 do
ThetaBn := (1/180)*i*Pi;
s := cos(2*ThetaBn)*x+(2*sin(ThetaBn)*sin(ThetaBn))*sin(x);
Point[i]:=[i,180.0*fsolve(s = 0, x, 1 .. 6)*(1/Pi)];
end do:
Points:=convert(Point,list);
plot(Points, color=red);

 

You forgot to take into account the triangle inequality, there are also a number of errors. Here is the corrected version:

E := proc(n::posint)
local p, k, x, y, z, L;
p:=n ; k:=0;
L:=table();
for x from 1 to floor(p/3) do
for y from x to floor((p-x)/2) do
z:=p-x-y;
if z<x+y then k:=k+1; L[k]:=[x,y,z] fi;
od; od;
convert(L, list);
end proc:

Examples of use:

E(3);
E(4);
E(9);
E(15);
                        

Edit.

This should probably be considered a bug in the  solve  command. Here are 2 workarounds (in Maple 2018.3):

RealDomain:-solve({x^2=2, x^3 = (sqrt(2))^3}, {x});
# Or
Sol1:=`union`(solve(x^2=2, {x}));
Sol2:=`union`(solve(x^3 = (sqrt(2))^3, {x}));
Sol1 intersect Sol2;

 

You can use  plots:-textplot  command for this:

restart;
with(plots):
P:=inequal({sqrt((1/2)*x) < y and sqrt(Pi/(2*x)) < y and y < sqrt(x) and y < sqrt(Pi/x)}, x = 1 .. 3, y = 0 .. 2):
T:=textplot([[1.5,1.7,sqrt(Pi/x)], [1.4,0.6,sqrt(x/`2`)], [2.5,0.6,sqrt(Pi/(`2`*x))], [2.5,1.7,sqrt(x)]], font=[times,bold,14]):
display(P,T);
                        

First 91 92 93 94 95 96 97 Last Page 93 of 290