Joe Riel

9660 Reputation

23 Badges

20 years, 4 days

MaplePrimes Activity


These are answers submitted by Joe Riel

You don't really need Maple for this, the computation is straightforward. However, it is easily done with Maple. 

sqrt(sum(int((x1[k]-x2[k])^2, x1[k]=0..1, x2[k]=0..1), k=1..n));
                                    1/2  1/2
                                   6    n
                                   ---------
                                       6

where n is the number of dimensions.

@Alec Mihailovs I like your suggestion; it fits and is humorous.  I'm not anticipating it being used by the moderators: "Due the reaction of some of the more unruly MaplePrimates, we have dropped the thumbs-down button."  That would add a certain levity, but probably wouldn't be appreciated by all.

Just ran into the bug where the content of my response was deleted, so am retyping. I can now see the response to which I'm responding; that is a welcome improvement.

I believe that the cooling term should be a boundary condition, it only applies to the end of the beam.  Following are the two lines I modified

pde := (rho*c/k) * diff(T(x,t),t) = diff(T(x,t),x,x):

ibc:=T(0,t)=200+273.15 , T(x,0)=200+273.15 , D[1](T)(2,t) = -(h*p/(k*A) ) * (T(2,t) - T2) :

If you increase the simulation time to, say, 1000 seconds, you can see the entire bar cooling down.

One problem is that Feq is not assigned anything.

In 2D math you can use prime notation, which by default uses x as the independent variable and, if applied to a name, makes the name a function of x.  Thus f'' might do what you want and is easy to enter.

It differentiated only half of it because of the way you entered the expression, that is, you have a product consisting of the derivative of exp(t/2) with the term cos(5*t).  Simpler, and possibly more useful, might be to do

y := exp(t/2)*cos(5*t)  

then take the derivative of y with respect to t. If you want to plot both y and its derivative with respect to t, you might assign the derivative to a separate variable and then plot them both:

dy := diff(y,t);

plot([y,dy], t=0..5);

You can type those in just as I've shown, or you can use the 2D notation, in which case your document might look like

f := x -> sin(x):
plot([f,D(f)], 0..3);

Because the DE has a singularity when y=0---so an integrator is going to fail there---you might as well remove the absolute value and lump the sign of the initial value of y into the parameter b.  Maple is then able to solve the DE symbolically.

Here's one approach

restart;
p[A] := [0, 0, 0]:
p[B] := [0, y[B], 0]:
p[C] := [x[C], y[C], 0]:
p[E] := [x[E], y[E], 0]:
p[S] := [x[S], y[S], z[S]]:

delta := (p, q) -> sqrt(add((p[i]-q[i])^2, i = 1 .. 3)):
L:=(a,b)->delta(p[a],p[b]);

Delta := (a,b,v)-> (delta(p[a], p[b])-v)^2:
T := Delta(A, B, .9)+Delta(B, C, 4.43)+Delta(C, E, 5.10)+Delta(E, A, 5.2)
    +Delta(A, C, 2.29)+Delta(B, E, 3.17)
    +Delta(S, A, 3.77)+Delta(S, B, 4.27)+Delta(S, C, 3.66)+Delta(S, E, 4.36):

# Alas,
Optimization:-Minimize(T);

# returns an error.  Instead, I'll compute the exterior
# derivative and then use fsolve to solve for a minimum.

vars := indets(T, name);
with(difforms);

defform(map(`=`,vars,0)[]);
dT := d(T):
eqs := map2(coeff,dT,d~(vars)):

xsol := fsolve(eqs);
eval([L(A,B),L(B,C),L(C,E),L(E,A)],xsol);
eval([L(A,S),L(B,S),L(C,S),L(E,S)],xsol);

While not the most efficient technique, you could do

iver := proc(e) if e :: {constant,relation(constant)} then if e then 1 else 0 fi else 'procname'(e) fi end: 
Sum(f(i)*iver(i::odd), i=1..n);                                                      
                                                     n
                                                   -----
                                                    \
                                                     )   f(i) iver(i::odd)
                                                    /
                                                   -----
                                                   i = 1

(**) value(eval(%,n=10));                                                                 
                                              f(1) + f(3) + f(5) + f(7) + f(9)



What is a "gradator"?  Do you mean gyrator?  I don't consider that a power electronics device, though occasionally they are used to simulate magnetics, however, with MapleSim there are better ways to do that.

Why do you say it should result in [0,0,0,1]?  The bitwise anding of [0,0,1,0] and [1,1,0,0] is [0,0,0,0]. 

Adding a multiplication symbol between the 2 and the 'cos', and 2 and 'sin' is a good idea.  Did you call

with(plots):

The animate procedure is exported by the plots package, so you either need to 'with' it, or use plots:-animate.

Not sure what you mean.  A typical Maple procedure looks like

myproc := proc( x, y)
     if x > y then
          return x;
     else
          return 2*y;
     end if
end proc:
myproc(1,2);
                             4
myproc(2,1);
                              2

You can do this without an index variable

cat('a', 1..40) := (5$40):

I'm not sure when Maple allowed cat on the left side of an assignment.

First 55 56 57 58 59 60 61 Last Page 57 of 114