Carl Love

Carl Love

28050 Reputation

25 Badges

12 years, 336 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

What makes you think that they can't be solved by Maple? Don't you think that it's more likely that it's you, not Maple, doing something wrong?

@jediknight Don't despair: I'm sure that it's possible with Maple V. I used it extensively when it was the current version, and I made many plots far more complicated than this. Try this:

semilogplot(
    map(q-> subs(Q= q, a), Qs), wx= 0.2..2,
    thickness= 5, axes= boxed, labels= [w, Gain], title= `Gain(w, Q, m)` 
);

The wx= 0.2..2 is an essential part of the command. The remaining plot options (from thickness to title) can be omitted until we get the basic plot correct. 

@jediknight You've used extra parentheses that weren't in my command. Also, you've changed plots to plot. It's the extra parentheses that are the direct cause of the error shown. They change the numbers of arguments (which the error message erroneously calls "parameters") of the seq from 2 to 1. 

@jediknight Please upload a worksheet (*.mws) showing the code execution from restart to the latest error.

@jediknight Try this:

plots[semilogplot](
    [seq](subs(Q= Qs[k], a), k= 1..nops(Qs)), wx= 0.2..2, thickness= 5,
    axes= boxed, labels= [w, Gain], title= `Gain(w, Q, m)` 
);

 

@jediknight Sorry about that; I don't have perfect memory of which version syntax enhancements were made.

Change in to =

@jediknight Like this:

plots[semilogplot](
    [seq](subs(Q= q, a), q in Qs), wx= 0.2..2, thickness= 5, axes= boxed,
    labels= [w, Gain], title= `Gain(w, Q, m)` 
);

The seq command is like an inline for-loop.

@jediknight Okay, change this line

Top:= subs(wx= x, Q= q, a);

to

Top:= evalf(subs(wx= x, Q= q, a));

Although what you did will work, it's better to use the evalf at the end of the calculation rather than at the beginning.

@jediknight Let be the gain function, which you want to maximize with respect to wx. Let G'(wx) be its derivative. You are doing this, essentially:

  1. Let wx_max be the unique positive solution to G'(wx) = 0.
  2. Let Top_of_Q be G(wx_max).
  3. Let wx_max be the unique positive solution to G(wx) = Top_of_Q.

Step 3 is redundant; wx_max is already known from step 1. The equation G'(wx) = 0 is easier to solve numerically than G(wx) = Top_of_Q, and fsolve will refuse to solve an equation if it can't guarantee the accuracy of the solution to 10 decimal places.

The code that I just gave you doesn't do step 3.

@mmcdara Thanks. The algcurves package I think predates my first Maple version, Maple V r4. Some of the highlighted points are where the tangent is horizontal or vertical; I don't know what the others are. The command plot_real_curve only works for polynomials in two variables, but I like it because it figures out the ranges for the variables automatically.

@delvin Your 1st line implicitly defines U as a function of xi. So, the next line should be

eq:= 6*c^2*U + 9*c*U^2 + 3*U^3 - diff(U, xi$2);

@jediknight I get this:

restart:
GainQ:= 8*wx^2*(m-1)/(Pi^2*sqrt((m*wx^2-1)^2+Q^2*wx^2*(wx^2-1)^2*(m-1)^2));
params:= [m=6];
Qs:= [0.20, 0.30, 0.40, 0.70, 1.0, 6.0]:
a:= subs(params, GainQ);
da:= numer(diff(a, wx));
for q in Qs do
    x:= fsolve(subs(Q= q, da), wx= 0.01..infinity);
    Top:= subs(wx= x, Q= q, a);
    printf(`Q = %a, wx_max= %a, Top = %a\n`, q, x, Top)
od:  

Q = .20, wx_max= .4257659439, Top = 2.043988894
Q = .30, wx_max= .4507684910, Top = 1.415858396
Q = .40, wx_max= .4927877155, Top = 1.124695001
Q = .70, wx_max= .7476605392, Top = .8641647894
Q = 1.0, wx_max= .8878848311, Top = .8306147086
Q = 6.0, wx_max= .9972137076, Top = .8110221752

Are any of these unexpected? If so, why?

What is your intended purpose of this line of code?

v := t->vs(t); l/~nvs;

The first part, v:= t->vs(t), is semantically equivalent to v:= vs; thus it serves no practical purpose. The second part, l/~nvs, has no practical effect at all because it doesn't change the value of any variable.

@mmcdara I think that convert(..., unit_free) is the way to go. If you encounter some situation where that doesn't work (I don't have any reason to suspect that such a situation exists, but Maple often surprises), then I think a reasonable alternative is

eval(..., Units:-Unit= 1)

@tomleslie I did see the bug that you described earlier today when I tried the same thing, but now it's gone. Try doing restart. If that doesn't fix it, try using 1-D input. (I'm quite curious which of those two fixes it.) Anyway, using my code from above with the only change being semilogplot instead of loglogplot, I get

First 71 72 73 74 75 76 77 Last Page 73 of 709