Kitonum

21540 Reputation

26 Badges

17 years, 117 days

MaplePrimes Activity


These are answers submitted by Kitonum

See  LinearAlgebra:-GenerateMatrix  command in Help.

Expr:=-(1/4)*G*r^2/eta-(1/4)*G*(ri^2-ro^2)*ln(r)/(eta*(ln(ri)-ln(ro)))-(1/4)*G*(ln(ri)*ro^2-ri^2*ln(ro))/(eta*(ln(ri)-ln(ro))):
Fact:=-(1/4)*G/eta:
``(Fact)*map(t->t/Fact, Expr); 

      

 

 

Addition.  This method does not work if the initial expression has members that do not contain the common factor to be taken out (below I have marked these members through C). Here's a way of solving the problem:

restart;
Expr:=-(1/4)*G*r^2/eta-(1/4)*G*(ri^2-ro^2)*ln(r)/(eta*(ln(ri)-ln(ro)))-(1/4)*G*(ln(ri)*ro^2-ri^2*ln(ro))/(eta*(ln(ri)-ln(ro)))+C:
Fact:=-(1/4)*G/eta:
solve(t=Fact, G):
subs(t=``(Fact), collect(subs(G=%, Expr), t));
           


 


 

as an example:

restart;
sol := dsolve({diff(i(t),t)+i(t)=0, i(0)=2}, i(t));
assign(sol);
i:=unapply(i(t), t);
plot(i(t), t = -1 .. 4, view = -1 .. 3, gridlines);
i(1);

 

Edit.

A := day(hello(a, b), c): 
op(0, A);
op([1, 0], A);

                                                                day
                                                               hello

 

Addition. If you want to extract the names of all functions simultaneously, you can use the following procedure:

restart;
P:=proc(Expr)
if op(Expr)=Expr then return NULL else
op(0,Expr), map(t->P(t), [op(1..-1, Expr)])[ ] fi;
end proc:

 

Example of use:

A := day(hello(a, morning(b)), night(c)):
P(A);

                                           day, hello, morning, night


 

Edit.

 

restart;
a:=convert(-1.327553040*10^37, fraction);

# Obviously the given number is 10^b where
b:=evalf[50](a/ln(10));
n:=floor(b);
c:=evalf[50](b-n);
10^c*10^``(n);   
# The answer in scientific notation with standard 10 digits accuracy

              

 

 

First, you can solve the equation for each value  T  in the range  300..800  with step 1, and then plot a graph using the data obtained (you will get a nice plot of even better quality than lower):

restart;
Data:=[seq([t,fsolve(eval(x*(3-2*x)^2/4/(1-x)^3=18325.73901+exp(36.58420421-10902.09286/T), T=t))], t=300..800)];
plot(Data);

 

Before the plotting both parts of the equation are multiplied by (1-x)^3 :

restart;
plots:-implicitplot(x*(3-2*x)^2/4=18325.73901*(1-x)^3+exp(36.58420421-10902.09286/T)*(1-x)^3, T=300..800, x=0..1, gridrefine=5);

          

 

 

In fact, this line intersects the circle at two points. Here are 2 ways to isolate the coordinates of these points (the second way is similar tomleslie's one only for two solutions):

eq1:= x^2+y^2=0.314:
eq2:= y=0.05180967688*x:
Sol:=solve({eq1,eq2}, [x,y]);
P1:=[seq(eval([x,y], s), s=Sol)];   
# The first way
P2:=map(rhs~, Sol);   # The second way

In Help see  DocumentTools:-Tabulate  command.

The most general way to specify a transformation in  R^2  or  R^3  is  plottools:-transform  command. In the following example, the unit circle is rotating by 90 degrees and simultaneously is reducing by 2 times:

restart;
f:=t->plottools:-transform((x,y)->convert(<cos(t),-sin(t); sin(t),cos(t)>.(<2,0>+(1-t/Pi)*(<x,y>-<2,0>)), list)):
A:=plots:-implicitplot((x-2)^2+y^2-1, x=-1..3, y=-1..3, color=red, thickness=2):
plots:-animate(plots:-display, ['f(t)'(A)], t=0..Pi/2, frames=100, scaling=constrained);

                 

                                     

Edit.

 

cycfunc:=proc(Expr, vars)
local n, P;
n:=nops(vars);
P:=[seq([seq(vars[j], j=i..n), seq(vars[j], j=1..i-1)], i=1..n)];
if `and`(seq(Expr=subs(`=`~(vars, p), Expr), p=P)) then return true else false fi;
end proc:

 

Example of use:

cycfunc(a^2*b + b^2*c + c^2*a, [a,b,c]);

                                                                          true


 

Here is the procedure for finding the minimum and the value of the variable  x  in which it is achieved (the nearest to a) according to your plan:

P:=proc(Expr, a, b, n)
local X, Y, m, i;
X:=[seq(a+k*(b-a)/n, k=0..n)];
Y:=[seq(eval(Expr,x=t), t=X)];
m:=min(Y);
for i from 1 to n+1 do
if Y[i]=m then return [X[i], m]  fi;
od;
end proc:

 

Example of use:

P(x^2-3*x+5, 0, 10, 100);
                                                               [3/2, 11/4]


 


 

 

f := x->0.012981+0.080285*cos(0.9519256799*x)+0.041370*cos(1.903851360*x)+
0.035690*cos(2.855777040*x)+0.000147*cos(3.807702720*x):
RootFinding:-Analytic(diff(f(x), x) = 0, x, re = -6 .. 6, im = -0.1 .. 0.1);
sort(simplify([%], zero));  
# Sorted list of all the extreme points

[-5.080827670, -4.391753823, -3.300249925, -2.208746026, -1.519672179, 0., 1.519672179, 2.208746026, 3.300249925, 4.391753823, 5.080827670]
 

Addition. If you need the coordinates of the points in a plane with an indication of the type of extremum it can be done as follows:

f := x->0.012981+0.080285*cos(0.9519256799*x)+0.041370*cos(1.903851360*x)+
0.035690*cos(2.855777040*x)+0.000147*cos(3.807702720*x):
RootFinding:-Analytic(diff(f(x), x) = 0, x, re = -6 .. 6, im = -0.1 .. 0.1):
sort(simplify([%], zero)):  
# Sorted list of all the extreme points
map(t->[`if`((D@@2)(f)(t)>0, Min, Max), [t, f(t)] ], %);  # These points in the plane

[[Min, [-5.080827670, -0.03003674673]], [Max, [-4.391753823, -0.01222338857]], [Min, [-3.300249925, -0.061477]], [Max, [-2.208746026, -0.01222338856]], [Min, [-1.519672179, -0.03003674679]], [Max, [0., 0.170473]], [Min, [1.519672179, -0.03003674679]], [Max, [2.208746026, -0.01222338856]], [Min, [3.300249925, -0.061477]], [Max, [4.391753823, -0.01222338857]], [Min, [5.080827670, -0.03003674673]]]

 

Max_Min_from_Graph1.mw

M := plottools:-arc([0, 0], 1, (1/6)*Pi .. 3*Pi*(1/4), color = blue, thickness = 4):
A:=plots:-display(plot(op(M)[1], color = "DeepPink", filled, scaling = constrained), M);
f:=plottools:-transform((x,y)->[x,y,0]):
plots:-display(f(A), scaling=constrained, axes=normal, view=[-1..1,0..1,0..0.5]);

 

Addition. Here is another way for 3d:

Arc:=plots:-spacecurve([x,sqrt(1-x^2),0], x=-1/sqrt(2)..sqrt(3)/2, color=blue, thickness=3):
B:=plot3d([x,y,0], x=-1/sqrt(2)..sqrt(3)/2,y=0..sqrt(1-x^2), style=surface, color = "DeepPink", scaling = constrained, axes=normal, view=[-1..1,0..1,0..0.5]):
plots:-display(Arc,B);

 

To investigate the dependence of the tangent field of a differential equation of a parameter, you can use  Explore  command:

restart;
Explore(DEtools:-DEplot(diff(y(x),x) = sqrt(1+(a*x)+(2*y(x))),y(x), x=-2..2, y=0..1), a=-2...2.);

 

First 165 166 167 168 169 170 171 Last Page 167 of 290