Carl Love

Carl Love

26518 Reputation

25 Badges

11 years, 191 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

The result returned by your dsolvexs, is of the form x(t) = ....  The plot command is complaining because you passed it an equation. The actual solution is the right-hand side of the equation. There are many ways  to isolate the right-habd side. One way that's easy to remember is rhs(xs). The way I generally prefer is eval(x(t), xs). Under ordinary circumstances you could give the plot command

plot(eval(x(t), xs), t= 0..3);

But these are not ordinary circumstances. The solution, although it appears short, is so complicated that Maple is having a lot of trouble evaluating it numerically. What we need to do is get a numeric solution from dsolve and then use plots:-odeplot to plot it:

xs:= dsolve({ics, ode}, numeric);
plots:-odeplot(xs, t= 0..3);

By the way, the right side of your ode has the useless coefficient 1^2. Did you intend for that to be something else?

How about this for the graphic?

N:= 96:
SP:= [seq](
     plots:-spacecurve(
          [1, k*3*Pi/N+Pi/2/N*floor(k/N), phi], phi= -Pi..Pi, coords= spherical,
          thickness= 9,
          transparency= 1-(N+k)/3/N
     ), k= 0..N
):
plots:-display(
     [plots:-display(
          [seq](plots:-display(SP[N+2-k..N+1]), k= 1..N+1)
         ,insequence
     ),
     plots:-tubeplot([0,0,t], t= -1..2, color= blue, radius= 0.05, transparency= .75),
     plots:-tubeplot([t,0,-1], t= -2..2, color= black, radius= 0.05, transparency= .6),
     plots:-tubeplot([0,t,-1], t= -2..2, color= black, radius= 0.05, transparency= .6),
     plot3d(-1, x= -2..2, y= -2..2, color= black, transparency= .5)
     ], axes= none, scaling= constrained, lightmodel= light4, style= patchnogrid,
     glossiness= 1
);

In the future, use square brackets for indexing (such as a[3]), not parentheses (such as a(3)).

Sys:= {seq}(eq(k), k= 1..18):

# Change to square brackets:
Sys:= subs([seq](a(k)= a[k], k= 1..18), Sys):
fsolve(Sys, {seq}(a[k], k= 1..18));

{a[1] = 0.000126988919895945, a[2] = -0.00105660821302691,
 a[3] = 0.00308434899631239, a[4] = -0.00423918949116484,
 a[5] = 0.00282464668788845, a[6] = -0.000740204565874612,
 a[7] = 0.290738925426173, a[8] = -1.17503115010852,
a[9] = 1.66075257813012, a[10] = -0.945945157740450,
 a[11] = 0.174368773622886, a[12] = -0.000158583197276566,
 a[13] = -0.00000150252845025158, a[14] = -0.0968979999980298,
 a[15] = 0.293699162347833, a[16] = -0.332030736202987,
 a[17] = 0.157521639797399, a[18] = -0.0248287447073636}

That took 3.45 seconds on my computer.

The residuals are not very good. You should use a high value of Digits (like 30) for the computation, and you should use more digits in your input constants.  I got good residuals (~ 10^(-19)) at Digits = 30.

This is difficult to diagnose without seeing the output of the previous commands. Nonetheless, I have an idea. Change the line

DE_C_tank_1 := diff(C_1(t), t)+m_out_tank_1*C_1(t)/M_tank_1-C_lost_tank_1 = Charge_rate_V3*C_V3/M_tank_1+Charge_rate_V4*C_V4/M_tank_1;

to

DE_C_tank_1 := diff(C_1(t), t)+~m_out_tank_1*C_1(t)/M_tank_1-C_lost_tank_1 =~ Charge_rate_V3*C_V3/M_tank_1+Charge_rate_V4*C_V4/M_tank_1;

The only difference is that I added two tildes (~), one after the first plus sign and one after the second equals sign. The purpose of the tilde is to "map" the operation over the whole Array. So, the output of the corrected command will be a single Array.

Let me know how that goes.

How about this?

Student:-Calculus1:-VolumeOfRevolution(
     sqrt(1-rho^2), -sqrt(1-rho^2), rho= 0..1,
     axis= vertical,
     output= animation
);
Student:-Calculus1:-VolumeOfRevolution(
     sqrt(a^2-rho^2), -sqrt(a^2-rho^2), rho= 0..a,
     axis= vertical,
     output= integral
);
value(%) assuming a>0;

You wrote:

I need to find a way to let Maple read the sigvm in 'normal' (x,theta) and plot them on (xcart,ycart,zcart) the deflected pile.

Try this (type it exactly like this (spacing doesn't matter)):

plot3d( 
     [xcart, ycart, zcart], 0 .. L, 0 .. 2*Pi,  
     color= unapply(sigvm(theta,x), [x,theta]),
     axes = boxed, scaling = constrained
);

We can trick rsolve into solving for a two-argument function by making the non-independent argument (i.e., the one fixed with respect to the recurrence) into an index.

 

Req:= g[m](n) = g[m-1](n)+g[m](n-1);

g[m](n) = g[m-1](n)+g[m](n-1)

Req[m=1]:= eval(Req, m= 1);

g[1](n) = g[0](n)+g[1](n-1)

rsolve(Req[m=1], g[1](n));

g[1](0)+Sum(g[0](n0), n0 = 1 .. n)

rsolve(Req[m=1], g[1](n), 'genfunc'(b));

-(Sum(g[0](n)*b^n, n = 1 .. infinity)+g[1](0))/(b-1)

 


By the way, there is no command Summation in Maple. The command is Sum (inert form) or sum (active form).

By the way (2), you probably know this, but your basic two-variable recurrence g(m,n) = g(m-1,n) + g(m,n-1) has solutions generally of the form binomial(m+n, m). The precise solution depends on initial and boundary conditions.

Download Two_var_rec_rel.mw

ex:= hyporesult(alpha,beta):
op(0,ex);
                           hyporesult
op(ex);
                          alpha, beta
op(1,ex);
                             alpha
op(2,ex);
                              beta
type(ex, typefunc(name));
                              true
type(ex, specfunc(name, hyporesult));
                              true
type(ex, anyfunc(name));
                             false
type(ex, anyfunc(name,name));
                              true
type(ex, typefunc(identical(hyporesult)));
                              true

(Putting it all together):
tree:= [F(ex)];
                  [F(hyporesult(alpha, beta))]

subsindets(
     tree,
     typefunc(identical(beta,alpha), name),
     f-> op(0,f)(Conj(op(1,f),gamma), op(2,f))
);
           [F(hyporesult(Conj(alpha, gamma), beta))]



Trying adding these commands at the beginning of a computation, or in an initialization file:

with(Units):

with(Units[Standard]):  or  with(Units[Natural]):

UseSystem('SI'):

See ?Units,UseSystem, ?Units,Systems, ?Units,Natural, ?Units,Standard

The most important of these for your problem are the with(Units[Standard]):  or  with(Units[Natural]): These will cause the units to be simplified automatically everytime an arithmetic operation is performed.

Example:

with(Units[Natural]):
891.73e-3*kN*m*mm/cm^4;
          
                    

Breaking off the k = 0 term provides a clue to what's going on. The answer is correct. We can see that it also uses cube roots of -1, but it does not express them in trigonometric form.

1+sum(1/(6*k+1)!, k= 1..infinity);


evalf(%);
                                         -16  
                  1.00019841285901 - 4 10    I

 

It's generally very easy to numerically integrate an implicit function by making the integrand a procedure which calls fsolve (to generate the y for a given x).

restart:

Equation of the model curve which when rotated about the x-axis produces an egg-shaped solid.

EggEqn:= (x^2+y^2)^2 - (a*x^3 + (a-b)*x*y^2);

(x^2+y^2)^2-(3/10)*x*y^2-x^3

Parameter:

(a,b):= 1, 7/10:

Get x intercepts for plot and integration limits.

solve(eval(EggEqn, y=0));

1, 0, 0, 0

P1:= plots:-implicitplot(
     EggEqn, x= 0..1, y= -1..1,
     gridrefine= 3, crossingrefine= 3, adaptranges,
     resolution= 2^11,
     filledregions, coloring= [yellow, white],
     scaling= constrained
):

Y:= X-> [fsolve](eval(EggEqn, x= X), y= 0..0.4)[1]:

Verify with a plot that Y traces the outline of the egg.

P2:= plot(Y, 0..1, scaling= constrained, thickness= 3, color= blue):

plots:-display([P1,P2]);

dydx:= implicitdiff(EggEqn, y, x);

-(1/2)*(40*x^3+40*x*y^2-30*x^2-3*y^2)/(y*(20*x^2+20*y^2-3*x))

Surface area of solid of revolution by method of "shells".

SA:= 2*Pi*Int(y*sqrt(1+Diff(y(x),x)^2), x= 'a'..'b');

2*Pi*(Int(y*(1+(Diff(y(x), x))^2)^(1/2), x = a .. b))

Area:= evalf(2*Pi*Int(X-> Y(X)*sqrt(1+eval(dydx, [x= X,y= Y(X)])^2), 0..1, digits= Digits-2));

2.04208853748980

 

 

Download EggArea.mw

There are many ways:

  1. Basic prefix form: `and`(A, `or`(B,C))
  2. Basic infix form: A and (B or C)
  3. In the ?type system: And(A, Or(B,C))
  4. In the ?property system: AndProp(A, OrProp(B,C))
  5. In the ?Logic package (prefix form): `&and`(A, `&or`(B,C))
  6. In the Logic package (infix form): A &and (B &or C))

One way to improve utilization: While a lengthy computation is running in one window, switch to another window and do some other type of work. You can even start another lengthy computation.

@spradlig Ah, that's different. Your original question had cos(Pi/4 - I*ln(2)), and now you have ln(2)/2. Anyway, if ex is the complex expression, then you can get your desired form by

expand(convert(ex, exp));

This works for both examples we've discussed in this thread.

I was wrong about evalc; it puts the expression, if possible, into the form Re(ex) + I*Im(ex), but it doesn't necessarily simplify the Re(ex) or Im(ex).
 

Maple is unable come up with a numeric approximation of the infinite sum. (Maple's ability with numeric infinite summation is much more limited than its ability with numeric integration.)

Your sum's nth term is of the form O(1)*exp(-A*n^2*t), where A is a positive constant. (Don't worry if you don't know what O(1) means.) The n^2 in the exponent makes the terms get very small very fast (assuming t > 0). So, those terms with, say, n > 20 make no appreciable difference in the sum.  So, just change the sum's upper limit from infinity to 20. The 20 is somewhat arbitrarily chosen, but I couldn't find any difference at 15 digits between 20 and 21. That's far more accuracy than you need for a plot. If you need a concrete proof that truncating the sum at a certain n makes no difference at a certain number of digits, let me know.

I don't think a logplot is appropriate for this function because the range of function values is quite small. Also, if you don't provide a range for the independent variable, t, the plot commands will use -10..10. So, you want something like

plot(eq, t= 0..10^4);

Remember that the truncation is only valid for t > 0.

First 354 355 356 357 358 359 360 Last Page 356 of 383