Kitonum

21530 Reputation

26 Badges

17 years, 85 days

MaplePrimes Activity


These are answers submitted by Kitonum

Obviously this is the series for the function  y->a*cos(sqrt(beta)*y)  (a  and  beta  are parameters) in the neighborhood  y=0

A check:

series(a*cos(sqrt(beta)*y), y = 0, 25);

         

 

 

 

 

Probably you mean a hexagonal prism?

f:=piecewise(x>-1 and x<-1/2, sqrt(3)*(x+1), x>=-1/2 and x<=1/2, sqrt(3)/2, x>1/2, -sqrt(3)*(x-1)):
plot3d(2, x=-1..1, y=-f..f, style=surface, color=khaki, filled);

                              

 

 

X:=[0, 1, 2, 3, 4]:
Y:=[1, 2, 2.5, 4, 3]:
plot(X, Y);

If you would like to curve was smoother, use  CurveFitting:-Spline  command (see help for details)

 

Addition. Here is a smooth curve through the same 5 points:

evalf[3](CurveFitting:-Spline(X,Y, x));
plot(%, x=0..4);

 

If I understand your problem properly then use  view  option (below is the changed the last line of your code):

display(f1, g1, view = [0.8 .. 1.2, 0 .. 0.4]);

                       

 

 

 

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

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