Kitonum

21525 Reputation

26 Badges

17 years, 75 days

MaplePrimes Activity


These are answers submitted by Kitonum

Eq := a*x+b*y+c = 0; 
expand((Eq-a*x-c)/b);

 

L1:=[1,2,3,4,5]:
L2:=[0,5,2,3,7]:
L3:=[7,5,2,3,2]:
convert~([L1,L2,L3], set);
`intersect`(%[]);

                     [{1, 2, 3, 4, 5}, {0, 2, 3, 5, 7}, {2, 3, 5, 7}]
                                             {2, 3, 5}

If necessary, we can take any subsets of this set.

You did not present your example in an editable form, so I am showing the solution with a simple example (terms with derivatives are left on the left side of the equation, the rest are moved to the right):

restart;
Eq:=2*x(t)+1/3*diff(x(t),t)-5=0;
Terms:=[op(lhs(Eq))];
(select,remove)(has,Terms,diff);
add(%[1])=-add(%[2]);


Of course, for use, this code should be written as a procedure, and then you can apply it to each of your differential equations.

restart;
Student:-Precalculus:-CompleteSquare(x^2 + y^2 - 10*x - 75 = 0, [x,y]);
% + 100;

                                    (x-5)^2+y^2-100 = 0
                                     (x-5)^2+y^2 = 100

Unfortunately, the  simplify  command does not always cope with the task. If you want to check the equivalence with one command, then you can use the  is  command:

 

restart;

expr1:=(-exp(n*Pi*(2*b - y)/a) + exp(n*Pi*y/a))/((exp(2*n*Pi*b/a) - 1)):
expr2:= sinh(n*Pi/a*y)/tanh(n*Pi/a*b)-cosh(n*Pi/a*y):
is(expr1-expr2=0);

true

(1)

 


 

Download q_new.mw

I wrote down all the code in 1d math (I hate 2d math input) and added the plotting of  x(t)  and  y(t) :

 

restart;

Phi:=<x(t), y(t)>;
Sys:=Equate(diff(Phi,t), <6,1; 4,3>.Phi+<6*t, -10*t+4>);
Sol:=dsolve(Sys);
plot(eval([x(t),y(t)], eval(Sol,[_C1=1,_C2=1])), t=0..0.5, color=[red,blue]);

Vector(2, {(1) = x(t), (2) = y(t)})

 

[diff(x(t), t) = 6*x(t)+y(t)+6*t, diff(y(t), t) = 4*x(t)+3*y(t)-10*t+4]

 

{x(t) = exp(7*t)*_C2+exp(2*t)*_C1-2*t-4/7, y(t) = exp(7*t)*_C2-4*exp(2*t)*_C1+10/7+6*t}

 

 


 

Download Solving_ODE_new.mw

Side surface and bases of a cylinder can be specified parametrically using 2 parameters (as any 2D surface).

Side:=plot3d([cos(t),sin(t),z], t=0..2*Pi, z=0..2, style=surface, color=green):
Base1:=plot3d([R*cos(t),R*sin(t),0], t=0..2*Pi, R=0..1, style=surface, color=green):
Base2:=plot3d([R*cos(t),R*sin(t),2], t=0..2*Pi, R=0..1, style=surface, color=green):
plots:-display(Side,Base1,Base2);

 

tax := 0.3*profit:
profit := 0.1*totalsalesx:
solve(totalsalesx = 60.1 + tax + profit);

                          69.08045977


If you need an absolutely accurate (symbolic solution) then use fractions:

tax := 3/10*profit: 
profit := 1/10*totalsalesx: 
solve(totalsalesx = 60+1/10 + tax + profit); 
floor(%) %+ frac(%); # Isolation of the whole part

                                    6010/87
                                   69 + 7/87  


 

restart;
lambda := 2*(1/10);                              
mu := -1;
beta := 10;                              
alpha := -25;                              
C := 1;                               
k := (1/12)*sqrt(6)/sqrt(beta*lambda*mu);                      
w := alpha/((10*sqrt(-lambda*mu))*beta);                           
A[0] := (1/2)*alpha/((10*sqrt(-lambda*mu))*((1/12)*beta*sqrt(6)/sqrt(beta*lambda*mu)));
A[1] := -(1/10)*alpha/((1/12)*beta*mu*sqrt(6)/sqrt(beta*lambda*mu));      
A[2] := -(12*((1/12)*sqrt(6)/sqrt(beta*lambda*mu)))*lambda^2*alpha/(10*sqrt(-lambda*mu));                    
H := ln(sqrt(lambda/(-mu))*tanh(sqrt(-lambda*mu)*(xi+C)));               
xi := k*x-t*w;
                   
u[0] := A[0]+A[1]*exp(-H)+A[2]*exp(-H)*exp(-H);
plot3d(Im(u[0]), x = -10 .. 10, t = -10 .. 10, view=-50..50);

1/5

 

-1

 

10

 

-25

 

1

 

-((1/24)*I)*6^(1/2)*2^(1/2)

 

-(1/4)*5^(1/2)

 

-((1/4)*I)*5^(1/2)*6^(1/2)*2^(1/2)

 

-((1/2)*I)*6^(1/2)*2^(1/2)

 

-((1/20)*I)*6^(1/2)*2^(1/2)*5^(1/2)

 

ln((1/5)*5^(1/2)*tanh((1/5)*5^(1/2)*(xi+1)))

 

-((1/24)*I)*6^(1/2)*2^(1/2)*x+(1/4)*t*5^(1/2)

 

-((1/4)*I)*5^(1/2)*6^(1/2)*2^(1/2)-((1/2)*I)*6^(1/2)*2^(1/2)*5^(1/2)/tanh((1/5)*5^(1/2)*(-((1/24)*I)*6^(1/2)*2^(1/2)*x+(1/4)*t*5^(1/2)+1))-((1/4)*I)*6^(1/2)*2^(1/2)*5^(1/2)/tanh((1/5)*5^(1/2)*(-((1/24)*I)*6^(1/2)*2^(1/2)*x+(1/4)*t*5^(1/2)+1))^2

 

 

A:=plots:-contourplot3d(Im(u[0]), x = -10 .. 10, t = -10 .. 10, color=red, thickness=3, contours=[seq(C,C=-40..40,10)], coloring=[white,blue], view=-50..50, filledregions=true, grid=[100,100]):

B:=plots:-contourplot(Im(u[0]), x = -10 .. 10, t = -10 .. 10, color=red, contours=[seq(C,C=-40..40,10)], grid=[100,100]):

f:=plottools:-transform((x,y)->[x,y,-50]):
plots:-display(A,f(B));

 

 


 

Download contours2d_3d.mw


 

restart;

ContoursWithLabels := proc (Expr, Range1::(range(realcons)), Range2::(range(realcons)), Number::posint := 8, S::(set(realcons)) := {}, GraphicOptions::list := [color = black, axes = box], Coloring::`=` := NULL)

local r1, r2, L, f, L1, h, S1, P, P1, r, M, C, T, p, p1, m, n, A, B, E;

uses plots, plottools;

f := unapply(Expr, x, y);

if S = {} then r1 := rand(convert(Range1, float)); r2 := rand(convert(Range2, float));

L := [seq([r1(), r2()], i = 1 .. 205)];

L1 := convert(sort(select(a->type(a, realcons), [seq(f(op(t)), t = L)]), (a, b) ->is(abs(a) < abs(b))), set);

h := (L1[-6]-L1[1])/Number;

S1 := [seq(L1[1]+(1/2)*h+h*(n-1), n = 1 .. Number)] else

S1 := convert(S, list)  fi;

print(Contours = evalf[2](S1));

r := k->rand(20 .. k-20); M := []; T := [];

for C in S1 do

P := implicitplot(Expr = C, x = Range1, y = Range2, op(GraphicOptions), gridrefine = 3);

P1 := [getdata(P)];

for p in P1 do

p1 := convert(p[3], listlist); n := nops(p1);

if n < 500 then m := `if`(40 < n, (r(n))(), round((1/2)*n)); M := `if`(40 < n, [op(M), p1[1 .. m-11], p1[m+11 .. n]], [op(M), p1]); T := [op(T), [op(p1[m]), evalf[2](C)]] else

if 500 <= n then h := floor((1/2)*n); m := (r(h))(); M := [op(M), p1[1 .. m-11], p1[m+11 .. m+h-11], p1[m+h+11 .. n]]; T := [op(T), [op(p1[m]), evalf[2](C)], [op(p1[m+h]), evalf[2](C)]]

fi; fi; od; od;

A := plot(M, op(GraphicOptions));

B := plots:-textplot(T);

if Coloring = NULL then E := NULL else E := ([plots:-densityplot])(Expr, x = Range1, y = Range2, op(rhs(Coloring)))  fi;

display(E, A, B);

end proc:

z := -y + sech(x - 3*t);

w := 10*sech(x - 3*t);

with(plots):

P1 := plot(eval(w, t = 0), x = -10 .. 10):
P2 := contourplot(eval(z, t = 0), x = -10 .. 10, y = -eval(w, t = 0) .. eval(w, t = 0), contours = 5, grid = [101, 101]):
display(P1, P2);

Q2:=ContoursWithLabels( eval(z, t = 0), -10 .. 10, -10..10, {-7,-3,1,5,9}, [color=blue,axes=box]):
display(P1,Q2);

-y+sech(-x+3*t)

 

10*sech(-x+3*t)

 

 

Contours = [-7., -3., 1., 5., 9.]

 

 

 


 

Download Contours.mw

I do not understand why you got solutions in terms of Bessel functions. The direct solution below is expressed through the function  erfi :

E:=1/2:
Eq := -(1/2)*(diff(psi(x), x, x))+(1/2)*x^2*psi(x) = E*psi(x); 
Sol := dsolve(Eq);
plot(eval(rhs(Sol),[_C1=2,_C2=1]), x=0..2);

 

There are different versions of this concept. See the wiki for this. For example, for functions defined on the positive half-axis (for the negative half-axis they are considered equal to 0), the problem reduces to calculating the integral over a finite interval, i.e. in Maple we can use the  int   function.

Example:

restart;
f:=t->sin(t):
g:=t->cos(t):
int(f(t)*g(x-t), t=0..x);
plot(%, x=0..10);


 

 

You did not specify what values the function  f  takes outside the segment  [0,1] . (Maple ignores your original assumption  assume(0 <= x, x <= 1)). By default, in this case outside the segment  [0,1]  the function  f  is considered equal to 0. If you specify in the definition of the function that it is undefined outside the segment  [0,1] , then everything is OK (see the function  g  below):
 

NULL

restart

assume(0 <= x, x <= 1); ode := diff(y(x), x) = 0

diff(y(x), x) = 0

(1)

dsolve(ode)

y(x) = _C1

(2)

f := proc (x) options operator, arrow; piecewise(0 <= x and x < 1/2, 1, x <= 1 and 1/2 <= x, 0) end proc

proc (x) options operator, arrow; piecewise(0 <= x and x < 1/2, 1, x <= 1 and 1/2 <= x, 0) end proc

(3)

f(-1); f(2); plot(f, -1 .. 2, color = red, axes = box, discont)

0

 

0

 

 

diff(f(x), x)

piecewise(x = 0, undefined, x = 1/2, undefined, 0)

(4)

g := proc (x) options operator, arrow; piecewise(0 <= x and x < 1/2, 1, 1/2 <= x and x <= 1, 0, undefined) end proc; diff(g(x), x); g(-1); g(2); plot(g, -1 .. 2, color = red, axes = box, discont)

g := proc (x) options operator, arrow; piecewise(0 <= x and x < 1/2, 1, 1/2 <= x and x <= 1, 0, undefined) end proc

 

piecewise(x = 1/2, undefined, 0)

 

undefined

 

undefined

 

 

NULL



You also wrote: "Whats is the relationship between this example and Existence and uniqueness theorem for fist order ode". I do not see any relationship here.

Download diff_piecewise_new.mw

If I understand the question correctly, then here is the solution (x(t)  is a vector-function  x(t)=<x1(t),x2(t)>):

restart;
A:=<1,2; 3,4>;
ODE:=Equate(diff(<x1(t),x2(t)>, t),A.<x1(t),x2(t)>);
dsolve({ODE[],x1(0)=0,x2(0)=1});

               

Here is a visalization of Joachimsthal's theorem using the ellipse  x^2/5^2+y^2/3^2=1  as an example. I took the point  P0=[1,1]  inside the ellipse and found 4 normals to the ellipse passing through this point (P0A, P0B, P0C, P0E  in the pic.). The point  E1  is diametrically opposite the point  E . I found the equation of the circle passing through points  A, B, C. We see in the pic. that this circle also passes through the point E1.

  
 

restart;
Ellipse:=plots:-implicitplot(x^2/5^2+y^2/3^2=1, x=-6..6,y=-6..6, color=blue):
P0:=[1,1]:
Sys:={x^2/5^2+y^2/3^2=1, (x-P0[1])*(y/3^2)-(x/5^2)*(y-P0[2])};
Sol:=[solve(Sys,explicit)]:
L:=map(t->eval([x,y],t),simplify(fnormal~(evalf(Sol),9), zero));
Points:=plots:-pointplot([L[],-L[2],P0], symbol=solidcircle, color=[red$5,green], symbolsize=15):
a:=L[1]: b:=L[3]: c:=L[4]: e:=L[2]: e1:=-e:
P0A:=plot([P0,a], color=green):
P0B:=plot([P0,b], color=green):
P0C:=plot([P0,c], color=green):
P0E:=plot([P0,e], color=green):
geometry:-circle(cc,[geometry:-point(A,a),geometry:-point(B,b),geometry:-point(C,c)]):
Eq:=geometry:-Equation(cc, [x,y]);
Circle:=plots:-implicitplot(Eq, x=-2..7, y=-4..4, color=red):
T:=plots:-textplot([[P0[],"P0"],[a[],A],[b[],B],[c[],C],[e[],E],[e1[],E1]],font=[times,18], align={below,right}):

plots:-display(Ellipse,Points, Circle, P0A, P0B, P0C, P0E, T, view=[-5.7..5.7,-3.7..3.7], scaling=constrained, size=[800,500]);

{(1/9)*(x-1)*y-(1/25)*x*(y-1), (1/25)*x^2+(1/9)*y^2 = 1}

 

[[1.30833205, 2.89547512], [-4.94896878, -.427521813], [4.80303934, -.833722213], [1.96259737, -2.75923109]]

 

-3.948442606+x^2+y^2-4.167340016*x-.2399612430*y = 0

 

 

 
 

 


Download Joachimsthal.mw

First 76 77 78 79 80 81 82 Last Page 78 of 290