Joe Riel

9660 Reputation

23 Badges

20 years, 3 days

MaplePrimes Activity


These are answers submitted by Joe Riel

The usual method, after the search returns, is to change to the "Table of Contents" tab.  If there is an entry for the topic in the Table of Contents, it should be highlighted. Is that not happening for MTM?  How 'bout for other topics?

The VectorCalculus package can be used here:

Y := (x/2)^(3/2):
len := VectorCalculus:-ArcLength(<x,Y>, x=A..B);
                                       3/2              3/2
                            (64 + 18 A)      (64 + 18 B)
                   len := - -------------- + --------------
                                 216              216


The usual way to do this is to substitute the variables you want, say

dsol := dsolve(diff(y(t),t) = y(t) + sin(t), y(t));
             dsol := y(t) = -1/2 cos(t) - 1/2 sin(t) + exp(t) _C1
subs(_C1=C1,dsol);
                  y(t) = -1/2 cos(t) - 1/2 sin(t) + exp(t) C1


If you had to do this a lot, you could hack up a procedure:

remove_leading_underscore := proc(expr)
local v,vars;
    vars := indets(dsol,'symbol');
    vars := select(v -> substring(v,1..1)=`_`, vars);
    subs([seq(v = substring(v,2..-1), v in vars)], expr);
end proc:

remove_leading_underscore(dsol);
                  y(t) = -1/2 cos(t) - 1/2 sin(t) + exp(t) C1

You should be able to use the VectorCalculus package to solve these.  I'll show you how to do two of them

with(VectorCalculus):

#2:
The domain is the portion of the unit-disk in the first quadrant.  Use Sector, with a Circle, to specify the domain:

int(ln(1+x^2+y^2), [x,y]=Sector(Circle(<0,0>,R),0,Pi/2));

#4:
You need to figure out what the domain is.  Remember completing the square:

dom := x^2+y^2=3*x:
Student:-Precalculus:-CompleteSquare((lhs-rhs)(dom));
                                      2    2
                             (x - 3/2)  + y  - 9/4
# You should recognize that as a circle with center at [3/2,0] and radius 3/2.
PathInt(x-y, [x,y]=Circle(<3/2,0>,3/2));

Note that if you are using 2D Math input you can enter this directly by typing

v''+v'+v=0

However, if you want the independent variable to be t (time) rather than x, you may need to modify the Typesetting rules. Click on View -> Typesetting Rules, and in the lower left corner of the pop up dialog, change the variable for "Prime Derivatives" to t.  If the "Prime Derivatives" box is not checked than check.  Click "Done".  Now you can type

v''+v'+v=0

Type "Enter", right-click on the result, and select either "Solve DE" for "Solve DE Interatively".  The latter allows you to easily specify boundary conditions so that the constants can be removed.

Equations 1.2  to 1.4 are wrong.  Because the pullies are assumed massless, the force balance on them is zero.  The diff-eq for m1 should be

m1*diff(x1(t),t,t) = m1*g - 2*T1

Eq. 1.6 is also wrong.  From the arrangement, 2*x1 + x2 = 0 (arbitrary any constant).

Use map:

alias(Q=Q(x,y,t),H=H(x,y,t)):
A := <Q/H|Q^2+H>:
map(diff, A, x);
                                             [d        /d   \                     ]
                                             [-- Q   Q |-- H|                     ]
                                             [dx       \dx  /      /d   \   /d   \]
                                             [---- - --------, 2 Q |-- Q| + |-- H|]
                                             [ H         2         \dx  /   \dx  /]
                                             [          H                         ]


 

Your third (first) graph is of the identity function, use z -> z in the list:

plot([z->z, ff, fr], 0..1, legend = [ideal,front,rear]);

or use an explicit independent variable:

plot([z, ff(z), fr(z)], z = 0..1, legend = [ideal,front,rear]);

The reason you cannot use sets is that Maple may reorder them, so there would be no way for Maple to associate a particular graph with a particular legend.

The division by zero possibility can be easily eliminated by clearing the denominator.  If you don't need to save all vaues of T[i], and are only interested in the final value, you could do this slightly differently:

eps := 0.001;
T := 1;
do
    dT := f(T);
    T := T + dT;
    if abs(dT) < eps*T then break end if;
end do;

I suspect that you should change the exit test to abs(dT) < eps*abs(T).  To cap the number of iterations you can count to a specific value, but exit early.

eps := 0.001;
T := 1;
success := false;
to 10^6 do
   dT := f(T);
   T := T + dT;
   if abs(dT) < eps*abs(T) then 
        success := true;
        break;
    end if;
end do;
if success <> true then error "maximum loop count exceeded" end if;
    

Another approach, suitable for expressions with one independent variable, is to use solve/identity.  See the help page ?solve,identity for details:

a_num := 1.330 :
b_num := 2.440 :
c_num := 3.660 :
 
func := ( a + b * x ) * exp( - c*x ):
func_num := eval(func, zip(`=`,[a,b,c],[a_num,b_num,c_num]));
                  func_num := (1.330 + 2.440 x) exp(-3.660 x)

solve(identity(func_num = func, x), [a,b,c]);
             [[a = 1.330000000, b = 2.440000000, c = 3.660000000]]


For the most part, you really cannot do that.  Maple automatically combines factors in a product.  A work-around is to use the empty function (see ?emptyfunction) to prevent recombination:

Y :=diff(A(t)/B(t),t);                              
                              d              /d      \
                              -- A(t)   A(t) |-- B(t)|
                              dt             \dt     /
                         Y := ------- - --------------
                               B(t)             2
                                            B(t)

applyop(curry(algsubs,A(t)/B(t)=``(A(t)/B(t))),2,Y);
                          d         /d      \   A(t)
                          -- A(t)   |-- B(t)|  (----)
                          dt        \dt     /   B(t)
                          ------- - -----------------
                           B(t)           B(t)

expand(%);
                           d              /d      \
                           -- A(t)   A(t) |-- B(t)|
                           dt             \dt     /
                           ------- - --------------
                            B(t)             2
                                         B(t)

Did you reassign the procedure shrinkTime?  Maple doesn't remember user-defined procedures (or other assignments) from one session to the next.  You can save procedures and other assignments into a custom Maple library, or just save the worksheet and reopen it.  The former is useful when you write procedures that you want to use in multiple places/worksheets.  However, it requires a bit of sophistication (not much).  Look at LibraryTools[Save].

You can use LeastSquares, in the CurveFitting package

 y := CurveFitting:-LeastSquares(Xvalues,Yvalues,x);
                       y := 1.237500350 + 0.4411684203 x

Also, look at Statistics:-LinearFit, which uses a slightly different syntax but may be more flexible for your needs.

Look at the help page for LinearAlgebra[ColumnSpace].

e is just a symbol to Maple.  Use exp(x) to express what you write as ex.

exp(sin(s*t));
                                 exp(sin(s t))

diff(%,t);
                           cos(s t) s exp(sin(s t))

First 95 96 97 98 99 100 101 Last Page 97 of 114