Kitonum

21835 Reputation

26 Badges

17 years, 221 days

MaplePrimes Activity


These are answers submitted by Kitonum

The problem is easy to solve, if we note that  abs(x1-x2)  is the distance between the points with the coordinates  x1  and  x2  on the real axis.

restart;
a:=0: b:=1.6: c:=4: d:=4.4:
f:=convert(abs(x-b)+abs(a-x)+abs(x-a)+abs(d-x)+abs(b-d), fraction):
minimize(f, x=0..convert(d, fraction));
plot(f, x=0..d, 0..15);  
# Visual check

                        

We see that the problem has no unique solution. The variable  x  can vary in the range  0 .. 1.6

 

Edit.

acer here gave a partial solution of the problem. Below the full solution is given

restart;
assume(n, posint):
r:=cos(t/n)^n:
x:=r*cos(t):  y:=r*sin(t):
r1:=eval(r,n=2):  r2:=eval(r,n=4):
plots:-display(<plots:-display(plot(r1, t=0..2*Pi, coords=polar, color=red), plot(r2, t=0..4*Pi, coords=polar, color=blue), title="Red curve for n=2, blue curve for n=4")| plots:-display(plot(r1, t=0..2*Pi, coords=polar, color=red), plot(r2, t=0..4*Pi, coords=polar, color=blue), view=[-0.05..0.05,-0.05..0.05], title="Zoom 20:1 near the origin")>, scaling=constrained);  # The plots of the curves for n=2 and n=4
PP1:=seq(simplify(convert([r1*cos(t),r1*sin(t)],radical)),t=[Pi/4,3*Pi/4]);  # 2 points on the first curve 
PP2:=seq(simplify([r2*cos(t),r2*sin(t)]),t=[Pi/3,Pi/2]);  # 2 points on the second curve 
P:=eval({[r1*cos(t),r1*sin(t)],[r2*cos(t),r2*sin(t)]}, t=0)[]; # The common point
Int(eval([sqrt('diff(x(t),t)'^2+'diff(y(t),t)'^2),t=0..n*Pi],n=4)[])=int(eval([sqrt(diff(x,t)^2+diff(y,t)^2),t=0..n*Pi],n=4)[]);  # The length of the curve for n=4
combine(simplify(diff(y,t)/diff(x,t))):
A:=op(trigsubs(numer(%)))/op(trigsubs(denom(%))); # This is simplified dy/dx
B:=(normal@expand)~(%);  # This is the desired form for dy/dx
sol:=solve(denom(A)=0, t, allsolutions);  # The formula for all the solutions
indets(%)[1]: # The name of a parameter in the set of all the solutions
h:=subs(%=1, sol);  # The smallest positive solution
n*Pi/h;  # The number of solutions in the range 0<=t<n*Pi 

           

    

Because all solutions are equally spaced, then the number of solutions is equal to the quotient of devision the  length of the interval by the smallest positive solution

 

In fact, these expressions are identical. See

restart;
A:=(sin(t)*sin(t/n)-cos(t)*cos(t/n)) /(sin(t)*cos(t/n)+cos(t)*sin(t/n));
x:=cos(t/n)^n*cos(t):
y:=cos(t/n)^n*sin(t):
w:=diff(x,t);
z:=diff(y,t);
B:=simplify(z/w);
simplify(A-B);

Output of the last command is  .

Example:

ff := t->plots:-display(plottools:-point([cos(t), sin(t), t], colour = red, symbolsize = 50, symbol = solidsphere));
plots:-animate(ff,[t], t=0..4*Pi, frames=100);

 

unapply causes an error due to premature calculation.

 

This a type is called rather than a structure:

A:=(a-b)*(c-d) + (e-f)*(g-h) = i:
whattype(A);
whattype(op(1,A));
whattype(op(2,A));
whattype(op([1,1],A));
whattype(op([1,1,2],A));

 

I added  L  to the unknowns in order to the number of unknowns equals to the number of equations:

Sys:={a[0]=L+(2*beta*mu)/(3*alpha*omega^2),a[1]=sqrt((4*mu)/(3*alpha*omega^2)),a[2]=(2*beta*mu)/(9*alpha*omega^2),a[3]=sqrt(mu^3/(432*alpha*omega^2)),omega[s]=omega-(mu^2/16*omega)-((2*beta^2*mu)/(9*alpha*omega))};
solve(Sys, {L,alpha,beta,mu,omega});

In this system, each equation contains only one unknown. Therefore each unknown can be found by the same formula with two parameters  a=sum(a[i], i=1..n)  and  b :

solve(a*x+x^3=b, x);

        

 

See  Wiki   for details.

Below we find the general and a particular solution of the equation for specific parameters:

restart;
Eq:=P=i(t)^2*r+diff(1/2*l(c)*i(t)^2, t)+1/2*i(t)^2*diff(l(c), c)*w:
dsolve(Eq, i(t));
Eq1:=eval(Eq, {P=2, r=3, l(c)=sin(c), w=1});
dsolve({eval(Eq1, c=Pi/3), i(0)=5}, i(t));

       

 

 

The recursive procedure  Prefix  automates the problem for 3 operations  `*`, `+`, `^` :

Prefix:=proc(Expr)
if type(Expr, `*`) then return func1(Prefix~([op(Expr)])[ ]) else
if type(Expr, `+`) then return func2(Prefix~([op(Expr)])[ ]) else
if type(Expr, `^`) then return func3(Prefix~([op(Expr)])[ ]) else
Expr  fi; fi; fi;
end proc:


Examples of use.

The original example:

Prefix(a^2*b+c);
                                                   


A more complicated example:

Expr:=(a*b*c+d^2)*(a+b*c^(-1))^3;
A:=Prefix(Expr);
subs({func1=`*`,func2=`+`,func3=`^`}, A);
expand(%);
 # Check
expand(Expr);

Addition. The procedure also works for division because

op(a/b);
whattype(a/b);

                                          a, b^(-1)
                                                *


 

You mean the prefix notation? In Maple it is implemented as (for your example)

restart;
L:=[a, b, c]:
`+`(`*`(L[1]$2, L[2]), L[3]);

                                                       a^2 * b + c
                               

Addition. Prefix notation is useful if you want to apply an operation to a large or indeterminate (in advance) number of operands.

A simple example - find the sum of the first 100 natural numbers:

`+`($ 1..100);
                                           5050

 

`if`(modp((n-1)!=-1, n^2), n, NULL) $ n=1..1000;

                                                                      1, 5, 13, 563

seq(`if`(modp((n-1)!=-1, n^2), n, NULL), n=1..1000);   # by  seq  command

                                                                      1, 5, 13, 563


for n from 1 to 1000 do   # by a  for  loop
if modp((n-1)!=-1, n^2) then print(n) fi;
od;

                                                                            1
                                                                            5
                                                                           13
                                                                          563
 

Edit.

3_ways.mw

If I understand your question, you want to solve the boundary problem for a variety of functions  f(x) . It is advisable to write as a procedure. Only note that this problem may not have a solution. But if it has a solution  u0(x) , it will have the infinite number of solutions  u0(x)+C*sin(x)

restart;
Sol:=F->dsolve({diff(u(x),x,x)+u(x)=F, u(0)=0, u(Pi)=0}):

 

Example of use:
Sol(-3*sin(2*x));
                                 u(x) = sin(x)*_C1+sin(2*x)

 

The file below shows your system in the desired form  Sys  (all second derivatives are in the left-hand sides of equations).

Model_Maple2.mw

Your system is complex and has many parameters. I think that such a system can only be solved numerically for specific parameter values and initial conditions. 
Here is my attempt for arbitrary values of parameters and initial conditions:

Model_Maple1.mw

 

Edit.

Cuts:=proc(n::posint)
local S, R, i, Arcs, P, M, E, PP, d, Eq, Seg, F, Eqs, Dev, a, u, v, r, G, m, j;
global C, IC, L;
uses plottools, plots;
C:=circle(color=blue, thickness=3);
IC:=disk(color="LightYellow");
S[1]:=[-1.2, 1.2]; # The first two points
Seg[1]:=[cos,sin]~(S[1]);  # The first line segment specified by the coordinates of its ends
L[1]:=line(Seg[1][], color=red, thickness=1); 
R:=[]; Eqs:=[];
for i from 1 to n-1 do
R:=sort([op(R),op(S[i])]); # The sorted list of points on the circle
Arcs:=[seq([R[i],R[i+1]], i=1..nops(R)-1), [R[-1],R[1]+2*Pi]]; # The arcs on the circle, formed by the points R
M:=map(t->abs(t[1]-t[2]),Arcs); d:=max(M); m:=nops(Arcs);
select(t->abs(t[1]-t[2])=d, Arcs)[1];
E:=(%[1]+%[2])/2; # The middle of the maximum arc
PP:=map(t->(t[1]+t[2])/2, Arcs);  # The list of points of all the arcs
F:=(x,y,Q)->(x-Q[1,1])*(Q[2,2]-Q[1,2])-(Q[2,1]-Q[1,1])*(y-Q[1,2]);
Eqs:=[op(Eqs), F(x,y,Seg[i])];
Dev:=map(t->[seq(eval(Eqs[i],{x=cos(t),y=sin(t)}),i=1..nops(Eqs))], PP);
a:=[seq(eval(Eqs[i],{x=cos(E),y=sin(E)}),i=1..nops(Eqs))];
for j from 1 to m do
[seq(a[k]*Dev[j,k], k=1..i)];
if `and`(seq(%[k]<0, k=1..i)) then break fi;
od;
u:=0.9*Arcs[j,1]+0.1*Arcs[j,2];  v:=0.1*Arcs[j,1]+0.9*Arcs[j,2];
r:=`if`(u<0 and v>0,rand(0..v-u),rand(u..v));
G:=`if`(u<0 and v>0,r()+u,r());
S[i+1]:=[E,G];
Seg[i+1]:=[cos,sin]~(S[i+1]); 
L[i+1]:=line(Seg[i+1][], color=red, thickness=1);
od;
display(C, IC, seq(L[i],i=1..n), axes=none);
end proc:

Examples of use.

The plot:

Cuts(5);

                            

 

The animation:

F:=n->plots:-display(C, IC, seq(L[i],i=1..round(n)), axes=none, scaling=constrained):
plots:-animate(plots:-display,['F'('n')], 'n'=0..5, frames=60);

                                       

 

Cuts.mw

Edit. The code of the procedure was edited.

First 168 169 170 171 172 173 174 Last Page 170 of 292