Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@savalan The problem that I see with these data-fitting methods is that they ignore that g(x) is a known function. This is not a data-fitting problem; it is a norm-minimization problem. The norm that I suggested using is N(f,g) = int(abs(f(x)-g(x)), x= A..B) for some suitable interval A..B; however, any norm will (theorethically) do the job of making f as close as possible to g. Squaring the abs inside the integral may make the computation easier, and it's just as valid.

Also, it's theorethically possible to use A = -infinity and/or B = infinity; it'll still be a valid norm. However, that may not be computationally feasible: The numeric integrations may take too long.

@Ronan 

sort(rts, key= abs);

@savalan We need a real interval A..B that contains the x-values. Then the function

H:= (a,b,c)-> evalf(Int(abs(f(x,a,b,c) - g(x)), x= A..B))

is a real-valued function of real variables. It should be possible to numerically approximate its minimum.

 

 

Is g(x) a known function? That is, can it be evaluated for any x (within a given range)? Or is its value only known for a specific sample of x-values?

@Kitonum The Question is to return the entry of minimal modulus; your code returns the minimal modulus of the entries. Those two things happen to be the same in this case, but that is just a coincidence.

@John Fredsted Thanks for spotting that.

@Rouben Rostamian  Suppose that f(t) is one of the functions (dependent variables) solved for by the command

dsolve(sys union {f(a) = fa}, numeric, ...);

and you want to compute F(T) = int(f(t), t= a..T). Then do

Sol:= dsolve(sys union {f(a) = fa, diff(F(t), t) = f(t), F(a) = 0}, numeric, ...);
eval(F(t), Sol(T));

where T is of type numeric.

Please let me know if you have any trouble implementing this.

@vv The command Logic:-Satisfy can be used to find an assignment of variables that makes a formula true.

@tomleslie Thanks, Tom. This one is interesting enough, regardless of whether it's exactly the same as your original.

So, if you take this very same worksheet (no copying) and re-execute it (by Ctrl-Shift-Enter or by Edit->Execute->Worksheet), does the error still occur?

@tsunamiBTP Yes, you may edit the original Question, including changing the atached file. Click on the More arrow at the bottom of the Question, then Edit.

@tomleslie Tom, Would you please post an executed copy of the worksheet showing the error occuring in 1D input? I have a feeling that the NULL-valued N[i] is not being transferred when you copy-and-paste to 1D. I think that this is a bug introduced into the 2D input in Maple 2017. Previously, the 2D input has had trouble with the statement

N[i]:= ();

which is a fine statement in 1D input.

I think that the problem is the number of variables, not the number of parentheses. There are 46 variables. If you were to construct a truth table for this expression, it would have 2^46 = 70 trillion rows.

If you delete the parentheses, some trivial simplifications come up, but you've completely altered the meaning of the expression, so any simplification is worthless.

 

@Ramakrishnan Your worksheet works for me without error. I suspect that your problem has something to do with the input format. I strongly disdain the 2D Input that you're using (It's not your fault, because it's the default.), especially for multi-line blocks of code like for loops. Try copying you loops to a 1D Input (aka Maple Input) field.

  1. Why do you want the result specifically to be a Matrix? You have the rows indexed by time and the columns indexed by frequency. Using a Matrix forces the number of entries to be (1 + number of times) x (1 + number of frequencies). By using a table instead of a Matrix, you wouldn't be restricted to the rectangular format; you could have separate times for each frequency.
  2. The way that you defined S3, it is an expression, not a procedure. Yet in the Matrix command you invoke S3(k) as if it were a procedure. Consequently, the current Matrix is filled with garbage, as you'll see if you inspect a few random entries.
  3. How would you do it in Matlab? It may be worthwhile us to directly translate some Matlab code.
  4. All you're doing is numerically evaluating S3 and different values of t of k. So why isn't having a procedure S3 of parameters t and k good enough? Why do you need a huge file of numeric evaluations of that procedure? It's not as if the procedure would take any significant amount of time to evaluate---it's quite a simple procedure.

@tsunamiBTP I might give a thumbs up to a Question that I recognize deserves further attention from someone else and that has sufficient richness and complexity, but for which I currently don't have an Answer.

First 351 352 353 354 355 356 357 Last Page 353 of 708