Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@dharr In that case, I vote up. Thanks for clarifying the worksheet.

@dharr It's a good Answer, but one detail needs to be addressed: series has option system as well as option remember, which means that you can't rely on a remembered result staying remembered---they get cleared by garbage collection. 

@jrive You asked:

  •  What do you mean by nontrivial solution?

Keep in mind that I'd misread that your intention was to solve for DCT, and tau. In that case, I would consider 
DC = ton/(ton + toff) to be a trivial and undesirable solution (although technically correct), and I strove to avoid it.

@Gabriel Barcellos In that case, I don't understand why you called it an "Incorrect answer".

@jrive The confusion was my fault. I simply misread "in terms of" as "for". 

It would be clearer, at least for me, if this were stated at the bottom of the Question.

@acer Thanks. I hadn't tried NextZero because I assumed that it couldn't work on something that can't be symbolically differentiated. But it's the winner among the methods shown.

All three methods get a 3X time boost by using option remember in BC2.

Although it didn't seem to give any trouble in this case, one might need to be wary of the singularity at a = -1 in some other situations.

@Gabriel Barcellos What was your result from eval(A1, exp= cos)? I get 5, which is correct because the cos terms sum to 0, as you said.

I can't display the worksheet inline, so I'll copy in the plots:



@acer Okay, I can get all 4 values of a from fsolve without any plot-based seed values, thus making the implitcitplot irrelevant. My procedure SubDivide searches all real intervals (starting with -infinity..infinity), splitting each interval when it contains a root, and discarding an interval when fsolve comes back with nothing. This extra fsolveing (especially the ones that return empty) adds nearly 2 seconds. That can be  reduced to about 1.5 seconds by using option remember on procedure BC2.

SubDivide:= proc(P, {maxsols::posint:= 99})
local Q:= DEQueue(-infinity..infinity), sols:= 0, intv, r;
    {while sols < maxsols do
        intv:= pop_back(Q);
        r:= fsolve(P, intv, 'avoid'= ({op}(intv) minus {infinity, -infinity}));
        if r::numeric then sols++; Q,= lhs(intv)..r, r..rhs(intv); r fi
    until empty(Q)}
end proc
:
Digits:= 10: #precision for fsolve
a_sols:= SubDivide(BC2);
    a_sols := {-3.535939019, -2.002235920, -0.7734241018, 0.1155584192}

Those are the same values as before. Thus, the plotting procedes exactly as before.

The Maple 2023 help ?fsolve,details mentions a method= subdivide option. I tried to use it, but it seemed to be completely ignored! So, I implemented my own SubDivide.

@Carl Love MaplePrimes incorrectly formatted the GUI output (including plots) from my worksheet above. I have no idea why. You'll need to download it and view it directly in Maple.

@C_R The OP means GUI "equation/table" labels such as what one can get with Ctrl-L or, from the menus, Insert => Label.

Your Question has been received! Please don't repost it to new threads. If you want to add additional information (you're welcome to do so), put it in this thread.

@Suryakanth The code in your Reply seems extremely familiar to me. I'm certain that this exact same Question or one extremely close to it has been asked, and Answered, here on MaplePrimes within the last year or so. Perhaps both you and the other person who asked it obtained that worksheet from the same source. Anyway, perhaps someone who is better at searching MaplePrimes than I am can find that other thread.

@imparter seems to be an index variable, especially since the code refers to m+1. Thus, the m:= 7.44, 7.88 from your 1st line doesn't make sense.

@imparter Your code assigns values in the 3D arrays (or tables) eq1, ..., eq4. But nothing sets any values in the 3D arrays (or tables) U, V, T, or C; not even any initial values.

First 33 34 35 36 37 38 39 Last Page 35 of 709