Rouben Rostamian

MaplePrimes Activity


These are answers submitted by Rouben Rostamian

In the attached worksheet I show how to generalize the definition of the pedal curve to pedal surface and calculate the equation of the pedal surface in the general case.  Then I illustrate the result by calculating the pedal surface of an ellipsoid with respect to its center.  Here is what it looks like.

Download pedal-surface.mw

No need for extra packages.  Just do this:

restart;
k := x -> piecewise(x < -6, 1/2*x + 10, x < -3, 1, x < 6*Pi, sin(1/2*x) + 2, x < 25, x - 15);
plot3d(k(x), t=0..2*Pi, x=-20..20, coords=cylindrical);

The parametrization of a surface (any surface) is not unque.  The way a surface is parametrized can have a drastic effect in how it is rendered on screen.

The standard parametrization of the oloid does not produce good computer-generated graphics as you have observed. But an oloid has a great deal of symmetries.  It is not difficult to see that it may be decomposed into four congruent patches, each of which has a quite "tame" parametrization for which Maple's default plotting grid is more than adequate.  Here I construct the oloid by putting together the four patches. 

restart;
alpha[1] := sin(t):
alpha[2] := -1/2 - cos(t):
alpha[3] := 0:
beta[1] := 0:
beta[2] := 1/2 - cos(t)/(1+cos(t)):
beta[3] := sqrt(1 + 2*cos(t))/(1+cos(t)):
x := (1-m)*alpha[1] + m*beta[1];
y := (1-m)*alpha[2] + m*beta[2];
z := (1-m)*alpha[3] + m*beta[3];
plot3d([[x,y,z], [x,y,-z], [z,-y,x], [-z,-y,x]], m=0..1, t=-Pi/2..Pi/2,
    scaling=constrained, color=[red,green,blue,yellow]);

I have colored the patches in four different colors in order to delineate them.  Change surface style and color as it suits your needs.

 

T := t -> (t+459.47) * 5/9;
seq(printf("%10d %10.2f\n", t, T(t)), t=100..110);
       100     310.82
       101     311.37
       102     311.93
       103     312.48
       104     313.04
       105     313.59
       106     314.15
       107     314.71
       108     315.26
       109     315.82
       110     316.37

 

Inversion in a sphere is much simpler than what you have in your worksheet.  Here is how I would do it.

Inversion in a sphere

Consider a sphere Sof radius R centered at the origin.  Let `#mover(mi("r"),mo("&rarr;"))` be the position vector of any

point Pin space. The inversion of P with respect to S is the point given by the position

vector `#mover(mi("&rho;",fontstyle = "normal"),mo("&rarr;"))` = R^2*`#mover(mi("r"),mo("&rarr;"))`/abs(`#mover(mi("r"),mo("&rarr;"))`)^2  provided that `#mover(mi("r"),mo("&rarr;"))` is nonzero.  We see that inversion maps the outside

of the sphere into the inside, and vise versa.  Let's note that in Cartesian coordinates
`#mover(mi("r"),mo("&rarr;"))` ="<x,y,z>     implies    (rho)=(R^(2))/(x^(2)+y^(2)+z^(2))*<x,y,z>."

 

Here we illustrate this graphically by inverting a torus in a sphere.

restart;

with(plots):

with(plottools):

The equation of a torus of radii a and b, displaced by d along the x axis in the Cartesian coordinates:

T := < d + (a + b*cos(s))*cos(t), (a + b*cos(s))*sin(t), b*sin(s) >;

Vector(3, {(1) = d+(a+b*cos(s))*cos(t), (2) = (a+b*cos(s))*sin(t), (3) = b*sin(s)})

The inversion of the torus in the sphere S

T__inverse := R^2/(T^+ . T) * T;

Vector(3, {(1) = R^2*(d+(a+b*cos(s))*cos(t))/((d+(a+b*cos(s))*cos(t))^2+(a+b*cos(s))^2*sin(t)^2+b^2*sin(s)^2), (2) = R^2*(a+b*cos(s))*sin(t)/((d+(a+b*cos(s))*cos(t))^2+(a+b*cos(s))^2*sin(t)^2+b^2*sin(s)^2), (3) = R^2*b*sin(s)/((d+(a+b*cos(s))*cos(t))^2+(a+b*cos(s))^2*sin(t)^2+b^2*sin(s)^2)})

Pick parameters for illustration:

params := { R=10, d=8, a=3, b=1 };

{R = 10, a = 3, b = 1, d = 8}

plots:-display([
        sphere(eval(R, params), style=line),
        plot3d(eval(T, params), s=0..2*Pi, t=0..2*Pi, style=surface, color="Green"),
        plot3d(eval(T__inverse, params), s=0..2*Pi, t=0..2*Pi)
], scaling=constrained, viewpoint=[circleleft, frames=100], axes=none);

 

 

Download inversion-in-sphere.mw

 

There are mnay ways of doing it, depending on what you want to do with the results.  Also it depends on how you represent quaternions.  You say that you want to represent a quaternion as a vector of length 4, but in your example your write qaa and qab as lists.  Lists and vectors are different types of objects in Maple.

Let's say you represent a quaternion as a list of length 4.  Then this will do what you want:

restart;

mult := proc(p::list,q::list)
        [
                p[1]*q[1] - p[2]*q[2] - p[3]*q[3] - p[4]*q[4],
                p[1]*q[2] + p[2]*q[1] + p[3]*q[4] - p[4]*q[3],
                p[1]*q[3] - p[2]*q[4] + p[3]*q[1] + p[4]*q[2],
                p[1]*q[4] + p[2]*q[3] - p[3]*q[2] + p[4]*q[1]
        ];
end proc:

 

mult([a,b,c,d],[e,f,g,h]);

[a*e-b*f-c*g-d*h, a*f+b*e+c*h-d*g, a*g-b*h+c*e+d*f, a*h+b*g-c*f+d*e]

mult([8,4,6,2], [2,4,6,8]);

[-52, 76, 36, 68]

That said, I much prefer the [scalar, vector] pair representation of quaternions (see the Wikipedia article) rather than lists of length 4.  But that again depends on what you want to do with them.

 

de := a*diff(y(x),x,x) + b*diff(y(x),x) + c*y(x) = 0;
dsolve(de) assuming b^2 < 4*a*c;

 

restart;

P := [[1,1], [6,6], [7,12], [8,15], [10,17]];

[[1, 1], [6, 6], [7, 12], [8, 15], [10, 17]]

plot(P);

Returns the endpoint coordinates of the segment of the "second gradient".

select_second := proc(P::list)
        local i, s, Q;

        if nops(P) < 3 then
                error "the argument P should have at least 3 points";
        end if;

        # calculate the sequence of slopes
        seq(P[i+1]-P[i], i=1..nops(P)-1);
        s := map(p -> p[2]/p[1], [%]);

        # find the first index where consecutive slops are different
        for i from 2 to nops(P)-1 do
                if s[i] <> s[i-1] then
                        break;
                end if;
        end do;
        if i = nops(P) then
                error "there is no second gradient in the given P";
        else
                Q := [ P[i], P[i+1] ];
        end if;

        return Q;
end proc:

select_second(P);

[[6, 6], [7, 12]]

 

Download mw.mw

 

Okay, your hand-written calculations are good.  Here I will do those in Maple.

restart;

In your hand calculations the symbol m is used with two

different meanings, first as an unknown exponent, and

second, as an abbreviation for "meter".  That's not a good.

I will write k for the exponent to remove the confusion.

expr := v = P/L * eta^n * R^k;

v = P*eta^n*R^k/L

Below, we work with expr/v, in order to make the left-hand side

of the expression into the dimensionless "1".

subs(v=m/s, P=N/m^2, L=m, eta=N*s/m^2, R=m, expr/v);
eq := simplify(%) assuming m>0, N>0, s>0;

1 = s*N*(N*s/m^2)^n*m^k/m^4

1 = m^(-4-2*n+k)*s^(1+n)*N^(1+n)

We want this equation to hold identically for all m, s, N.  Therefore the

exponents of these quantities should be zero, that is,

sys := { -4 - 2*n + k = 0, 1 + n = 0, 1 + n = 0 };

{1+n = 0, -4-2*n+k = 0}

solve(sys);

{k = 2, n = -1}

This answer agrees with your hand calculations.

 

Note:  I formed the expression "sys" above by typing the three

exponents by hand.  It is possible to have Maple extract those

exponents programmatically but that would go far beyond the

scope of the beginner user of Maple.

 

Download mw.mw

 

How do you like this?

restart;

# macro emulates Matlab's "jet" colorscheme:
macro(jet=["zgradient", ["DarkBlue", "Blue", "DeepSkyBlue", "Cyan", "LawnGreen", "Yellow", "Orange", "Red", "DarkRed"]]):

plot3d((1-xi^2)*(1+tau), tau=-1..1, xi=-1..1,
    colorscheme=jet, orientation=[-120,72,0], axes=framed);

plot3d((1-xi^2)*(1+tau), tau=-1..1, xi=-1..1,
    colorscheme=jet, gridstyle=triangular, orientation=[-120,72,0]);

As Kitonum has noted, this is not an infinite fraction.  The integrand is z = ..  Then we see that z^2 = x*z, and therefore z = x.  Then the integral of z is x^2/2 + constant.  QED.

Forget about solve.  After you define psi, just do:

plots:-contourplot(psi, x=-1..1, eta=-2..2);

 

Try this:

restart;
plot(x^2, x=-1..1, labels=[typeset(NFE), typeset(log__10(`Max Err`))]);

Here is a slightly modified version of your worksheet.  The determinant grows too fast for efficient numerical calculations.  Therefore I have scaled it by dividing by cosh(...) which does not affect the roots since cosh is never zero.  Then you see that you can calculate the first five roots without any fuss.

Download Natural_frequency_No_Foundation_Mass-modified.mw

 

If you look closely at your equations, you will see that at some places you have x, and at some other places you have x(t).  They should all be x(t).  Same goes for y(t) and u(t).

I have fixed these in the attached worksheet.  Note the technique—to define a differential equation dx/dt = F(x,y,u), we begin with defining the function (not an expression!) F, and then express the equation as dx(t)/dt = F(x(t), y(t), u(t)).

But note that the solution to your system is not defined in the entire length of the time interval that you have requested.  Since you have x, y, and u in the denominators, the solution stops when any of these variables reaches zero.

restart;

with(DEtools):

p := 2*u*x*y^2;
q := (x-1)/x;

2*u*x*y^2

(x-1)/x

doth := simplify(-(sqrt(6)*x^3*(y-1)^2+u*((3+sqrt(6))*x^3*(y-1)^2+3*y^2-9*x*y^2+3*x^2*(y^2+2*y-1)))/p);

(1/2)*(-x^3*(y-1)^2*(u+1)*6^(1/2)-3*(x-1)*((y-1)^2*x^2+2*x*y^2-y^2)*u)/(u*x*y^2)

ddotphi := simplify((y-1)*(sqrt(6)*x*y^2*(x-1)+u*(3*y^2-(6+sqrt(6))*x*y^2+x^2*((3+sqrt(6))*y^2+6*y-3)))/p);

(1/2)*(y-1)*(x*y^2*(x-1)*(u+1)*6^(1/2)+3*((x-1)^2*y^2+2*x^2*y-x^2)*u)/(u*x*y^2)

x*(1-x)*doth - x^2*ddotphi/sqrt(6):
F1 := unapply(%, [x,y,u]);    # the right-hand side of ode1

proc (x, y, u) options operator, arrow; (1/2)*(1-x)*(-x^3*(y-1)^2*(u+1)*6^(1/2)-3*(x-1)*((y-1)^2*x^2+2*x*y^2-y^2)*u)/(u*y^2)-(1/12)*x*(y-1)*(x*y^2*(x-1)*(u+1)*6^(1/2)+3*((x-1)^2*y^2+2*x^2*y-x^2)*u)*6^(1/2)/(u*y^2) end proc

ode1 := diff(x(t),t) = F1(x(t),y(t),u(t));

diff(x(t), t) = (1/2)*(1-x(t))*(-x(t)^3*(y(t)-1)^2*(u(t)+1)*6^(1/2)-3*(x(t)-1)*((y(t)-1)^2*x(t)^2+2*x(t)*y(t)^2-y(t)^2)*u(t))/(u(t)*y(t)^2)-(1/12)*x(t)*(y(t)-1)*(x(t)*y(t)^2*(x(t)-1)*(u(t)+1)*6^(1/2)+3*((x(t)-1)^2*y(t)^2+2*x(t)^2*y(t)-x(t)^2)*u(t))*6^(1/2)/(u(t)*y(t)^2)

y*(y-1)*doth:
F2 := unapply(%, [x,y,u]);        # the right-hand side of ode2

proc (x, y, u) options operator, arrow; (1/2)*(y-1)*(-x^3*(y-1)^2*(u+1)*6^(1/2)-3*(x-1)*((y-1)^2*x^2+2*x*y^2-y^2)*u)/(y*u*x) end proc

ode2 := diff(y(t), t) = F2(x(t),y(t),u(t));

diff(y(t), t) = (1/2)*(y(t)-1)*(-x(t)^3*(y(t)-1)^2*(u(t)+1)*6^(1/2)-3*(x(t)-1)*((y(t)-1)^2*x(t)^2+2*x(t)*y(t)^2-y(t)^2)*u(t))/(y(t)*u(t)*x(t))

sqrt(3/2)*u*(1+u)*q:
F3 := unapply(%, [x,y,u]);          # the right-hand side of ode3

proc (x, y, u) options operator, arrow; (1/2)*6^(1/2)*u*(u+1)*(x-1)/x end proc

ode3 := diff(u(t), t) = F3(x(t),y(t),u(t));

diff(u(t), t) = (1/2)*6^(1/2)*u(t)*(u(t)+1)*(x(t)-1)/x(t)

indets({ode1,ode2,ode3});

{t, diff(u(t), t), diff(x(t), t), diff(y(t), t), u(t), x(t), y(t)}

DEplot3d([ode1, ode2, ode3], [x(t), y(t), u(t)], t = -2 .. 2, x = 0 .. 1, y = 0 .. 1, u = -1 .. 0, [[x(0) = .9, y(0) = .25, u(0) = -.95], [x(0) = .9, y(0) = .25, u(0) = -.5], [x(0) = .85, y(0) = .2, u(0) = -.15], [x(0) = .25, y(0) = .5, u(0) = -.5], [x(0) = .7, y(0) = .5, u(0) = -.6]], linecolor = [red, green, black, navy, maroon], thickness = 2, axes = boxed, labels = [x(t), y(t), u(t)], stepsize = 0.1e-1, orientation = [30, 65]);

Warning, plot may be incomplete, the following errors(s) were issued:
   cannot evaluate the solution further right of .16790195, probably a singularity
Warning, plot may be incomplete, the following errors(s) were issued:
   cannot evaluate the solution further right of .51702724e-1, probably a singularity
Warning, plot may be incomplete, the following errors(s) were issued:
   cannot evaluate the solution further right of .57085115e-2, probably a singularity
Warning, plot may be incomplete, the following errors(s) were issued:
   cannot evaluate the solution further right of .54099962, probably a singularity

 

Download mw.mw

 

First 13 14 15 16 17 18 19 Last Page 15 of 53