Kitonum

15359 Reputation

24 Badges

12 years, 100 days

MaplePrimes Activity


These are answers submitted by Kitonum

You can plot the indefinite integral:

M:=10^8:
plot(int(x^2*exp(Pi*x/10^12*M), x), x = 0 .. 1000);

To better compare the graphics,  scaling=constrained option is used and the range on vertical axis is limited.

V:=(2*x^2+2*y+gamma)*y^3:

a0:=subs(x=0.9,gamma=0,V):

a1:=subs(x=0.9,gamma=2,V):

a2:=subs(x=0.9,gamma=4,V):

 

b0:=subs(x=0.1,gamma=0,V):

b1:=subs(x=0.1,gamma=2,V):

b2:=subs(x=0.1,gamma=4,V):

 

A:=plot([a0,a1,a2], y = 0 .. 1, 0..5, linestyle = [dot, dash,dot], color = [red, blue,green]): 

B:=plot([b0,b1,b2], y = 0 .. 2, 0..5, linestyle = [dot, dash,dot], color = [red, blue,green]):

 

plots[display](< display(A) | display(B) >, scaling=constrained);

a1:=plot(x^2,x=1..2): a2:=plot(x^2,x=3..4): a3:=plot(x^2,x=4..5):

b1:=plot(x^3,x=1..2): b2:=plot(x^4,x=1..2): b3:=plot(x^5,x=1..2):

a:=a1,a2,a3:  b:=b1,b2,b3:

A:=Vector([a]):

B:=Vector([b]):

with(plots):

display(< A|B >);

display(LinearAlgebra[Transpose](< A|B >));

P:=proc(L::list)

local M, F, Max, S, i;

M:=convert(L, set);

F:=[seq([M[i], ListTools[Occurrences](M[i], L)], i=1..nops(M))];

print(F);

Max:=max(seq(F[i, 2], i=1..nops(M)));

S:=[];

for i in F do

if i[2]=Max then S:=[op(S), i[1]]; fi;

od;

op(S);

end proc: 

 

Example:

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

P(L);

      [[1, 1], [2, 1], [3, 13], [4, 4]]

                       3


What means your dual equality? The system of equations? If  only the first equation is acceptable and from the boundary conditions to retain only the first two, Maple finds the only one trivial solution. Assuming that Maple was right,  the initial boundary value problem has no solution.

dsolve({(diff(f(x), x))^2-f(x)*(diff(f(x), x, x)) = diff(f(x), x, x, x)-100*(diff(f(x), x))-0.001*(2*(diff(f(x), x))*(diff(f(x), x, x, x))-f(x)*(diff(f(x), x, x, x, x))-(diff(f(x), x, x))^2), f(0) = 0, ((D@@2)(f))(0) = 0}, f(x));

                                                                        f(x)=0

It is easy to prove that there are no such triangles in the plane. In space there are infinitely many such triangles. The smallest will be (3, 0, 0), (0, 3, 0), (0, 0, 3) . Its easy to find a simple search.

PS. It can be found without brute force if you know that in any cube, there are 3 vertices of the cube, forming an equilateral triangle.

A:=plot(sin(x), x=-Pi..Pi, color=red):
B:=plot(cos(x), x=-Pi..Pi, color=blue):

plots[display](Array([A, B]));

I think that we should not trust to the symbolic solutions of the equations with the parameters obtained with Maple. Here are two simple examples.

with(RealDomain):

solve(sqrt(x-a)=x, x);

solve(a*x^2-2*x+4=0, x);

Both answers are incorrect. The first equation has two solutions only in the range  0 <=a< 1/4 . For other values ​​of the parameter  a  there are no solutions or only one solution. This is easily seen by constructing graphs. 

The solution of the second equation is correct only for  a<>0  and  a<=1/4 .

Both equations can be correctly solved in the package Mathematica. Here, for example, the first example:

Your equation  3a(1+z)^2=2(a(1+z)^3+b)^(1/2)  with two parameters  a  and  b  is much more complex. You can correctly and  explicitly solve it in Mathematica by using commands

ToRadicals[
Reduce[3*a*(1 + z)^2 == 2*(a*(1 + z)^3 + b)^(1/2), z, Reals]]
The output is very cumbersome.

f:= A^2-2*sqrt(A^2+1)+1;

f2:= simplify(algsubs(A^2+1 = M^2,  f)) assuming M>0;

             f := A^2-2*(A^2+1)^(1/2)+1

                     f2 := M^2-2*M

The procedure Routes finds all the routes with a travel length of n in a NxN square and the number of such routes.

Routes:=proc(N::posint, n::nonnegint)

local L, Rule; global T;

if n>=N^2 then T:=[]: print(0);   else

L:=[seq(seq([[i, j]], j=1..N), i=1..N)];

 

Rule:=proc(K)  # Continuation of the route by 1 step

local S, k, M, r, p;

S:=[ ]; k:=nops(K[1]);

for r in K do

M:=[ ]:

if r[k]=[1, 1] then for p in [[1, 2], [2, 2], [2, 1]] do  # Bottom left corner

if convert([seq(r[i]<>p, i=1..k-1)], `and`) then M:=[op(M),[op(r), p]]: fi:

od:

S:=[op(S), op(M)]: fi:

if r[k]=[1, N] then for p in [[1, N-1], [2, N-1], [2, N]] do  # Top left corner

if convert([seq(r[i]<>p, i=1..k-1)], `and`) then M:=[op(M),[op(r), p]]: fi:

od:

S:=[op(S), op(M)]: fi:

if r[k]=[N, N] then for p in [[N-1, N], [N-1, N-1], [N, N-1]] do  # Top right corner

if convert([seq(r[i]<>p, i=1..k-1)], `and`) then M:=[op(M),[op(r), p]]: fi:

od:

S:=[op(S), op(M)]: fi:

if r[k]=[N, 1] then for p in [[N-1, 1], [N-1, 2], [N, 2]] do  # Bottom right corner

if convert([seq(r[i]<>p, i=1..k-1)], `and`) then M:=[op(M),[op(r), p]]: fi:

od:

S:=[op(S), op(M)]: fi:

if r[k,1]=1 and r[k,2]<>1 and r[k,2]<>N then for p in [[1, r[k,2]-1], [2, r[k,2]-1], [2, r[k,2]-1], [2, r[k,2]+1], [1, r[k,2]+1]] do                      # Left side

if convert([seq(r[i]<>p, i=1..k-1)], `and`) then M:=[op(M),[op(r), p]]: fi:

od:

S:=[op(S), op(M)]: fi:

if r[k,2]=N and r[k,1]<>1 and r[k,1]<>N then for p in [[r[k,1]-1, N], [r[k,1]-1, N-1], [r[k,1], N-1], [r[k,1]+1, N-1], [r[k,1]+1, N]] do                    # Top side

if convert([seq(r[i]<>p, i=1..k-1)], `and`) then M:=[op(M),[op(r), p]]: fi:

od:

S:=[op(S), op(M)]: fi:

if r[k,1]=N and r[k,2]<>1 and r[k,2]<>N then for p in [[N, r[k,2]+1], [N-1, r[k,2]+1], [N-1, r[k,2]], [N-1, r[k,2]-1], [N, r[k,2]-1]] do                    # Right side

if convert([seq(r[i]<>p, i=1..k-1)], `and`) then M:=[op(M),[op(r), p]]: fi:

od:

S:=[op(S), op(M)]: fi:

if r[k,2]=1 and r[k,1]<>1 and r[k,1]<>N then for p in [[r[k,1]-1, 1], [r[k,1]-1, 2], [r[k,1], 2], [r[k,1]+1, 2], [r[k,1]+1, 1]] do                    # Bottom side

if convert([seq(r[i]<>p, i=1..k-1)], `and`) then M:=[op(M),[op(r), p]]: fi:

od:

S:=[op(S), op(M)]: fi:

if r[k,1]<>1 and r[k,1]<>N and r[k,2]<>1 and r[k,2]<>N then for p in [[r[k,1]-1, r[k,2]-1], [r[k,1]-1, r[k,2]], [r[k,1]-1, r[k,2]+1], [r[k,1], r[k,2]+1], [r[k,1]+1, r[k,2]+1], [r[k,1]+1, r[k,2]], [r[k,1]+1, r[k,2]-1], [r[k,1], r[k,2]-1]] do  # Inside

if convert([seq(r[i]<>p, i=1..k-1)], `and`) then M:=[op(M),[op(r), p]]: fi:

od:

S:=[op(S), op(M)]: fi:

od;

S;

end proc;

 

T:=(Rule@@n)(L);  # List of all the routes

nops(T);  # Number of all the routes

fi;

 

end proc;


Example:

Routes(4, 6);

T[10000]; T[20000]; T[60000];

 

See http://www.mapleprimes.com/questions/142417-Generating-Matrix-Code

In your recurrence equation, that to find all  U[i+1, j+1]  need to know the values ​​of the previous two rows and two columns.

solve(r*U[i-1,j+1] -2*r*U[i,j+1] +r*U[i+1,j+1] = r*U[i-1,j] -2*r*U[i,j] +r*U[i+1,j], U[i+1,j+1]);

 
 Therefore, in the matrix must be specified the first two rows and columns.

Formal arguments of the procedure:  L1, L2, M1, M2 - the first two rows and the first two columns of the matrix.
Code of the procedure:

P:=proc(L1, L2, M1, M2)

local f, n, i, j, U;

f:=(i, j) -> U[i-1,j]-2*U[i,j]+U[i+1,j]-U[i-1,j+1]+2*U[i,j+1];

n:=nops(L1);

for i from 1 to n do

U[1, i]:=L1[i]; U[2, i]:=L2[i]; U[i, 1]:=M1[i]; U[i, 2]:=M2[i];

od;

for i from 2 to n-1 do

for j from 2 to n-1 do

U[i+1, j+1]:=f(i,j);

od; od;

Matrix([seq([seq(U[i, j], j=1..n)], i=1..n)]);

end proc; 


Example:

P([1, 3, 4, 4.5, 4.75],[3, 5, 6, 6.5, 6.75], [1, 3, 4, 4.5, 4.75], [3, 5, 6, 6.5, 6.75]);

The number  e  is coded in Maple as  exp(1) . If you are used to the traditional designation, at first you must to assign to the symbol  e  this value or use a palette:

e:=exp(1):
evalf(e);

2.718281828

To the 1st question:

restart;

f:=x->piecewise((x>=0.19740 and x<0.91510) or (x>=3.3390 and x<4.0567), tan(x), undefined);

plot(f(x), view=[-1..5, -0.5..1.5], scaling=constrained);


To the 2nd question:

restart;

solve({ 0.2 <= tan(x), tan(x)< 1.3, x>0, x<Pi});

plot(tan(x), x=lhs(%[1])..rhs(%[2]));

You can easily build the new graph as a parametrically defined curve (see ?plot/details):

restart;

x, y, m, n:=1, 2, 3, 4:

sol:=dsolve({(D(a))(t) = x-y*a(t), (D(b))(t) = m*a(t)-n*b(t), a(0)=0, b(0)=0.5}, {a(t), b(t)}):

a:=unapply(rhs(sol[1]), t):

b:=unapply(rhs(sol[2]), t):

h:=unapply(60/0.98 * a(t)*b(t), t):

plot([a(t), h(t), t=0..10], thickness=2, labels=["a(t)", "h(t)"]);

First 219 220 221 222 223 224 225 Last Page 221 of 239