Carl Love

Carl Love

28155 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

@vv Vote up. But I think that your double-arrow solution is better than unapply, which has a lot of complexity that's not needed for this problem (see showstat(unapply)). Your solution can be abbreviated to

(a-> x-> a*x)~([$1..3])[];

@ You're conflating left- and right-side solutions. Up until this point, we've been solving the equation A.x = b for x. To solve the queueing problem, you need to solve x.A = b. The solution to this equation is indeed <1,1,1,1> (as a row vector). To solve this using Maple, do

IterativeApproximate(A^+, b, ...);

where the A^+ is Maplese for the transpose of A.

Please use the Reply button on the post that you are replying to to make replies. You've been using the Answer button on your original Question.

@ If I use b = <1, 0, 0, 0 >, then I do get the same result as you:

Vector(4, {(1) = 1.000428778, (2) = 0.2467490013e-3, (3) = 0.1892815477e-3, (4) = 0.1451981728e-3})

which does have the low residual that I posted.

@Vic You'll need to show me that in a worksheet. My Array prints horizintally. If you don't want to see the output, end the command with a colon (:):

Array([4, 5, 7]):

@ At this point I need to see the complete code of f in order to diagnose it further. For one thing, I need to verify that f has exactly four parameters.

The following has nothing to do with your errors, but you inaccurately transcribed something that I wrote before. The command's name is Optimization:-NLPSolve, not Optimization-NLPSolve.

@ Your objective procedure f needs to have four parameters---not a a single parameter x which you subscript as x[1], x[2], etc. You might as well name the four parameters x1, x2, etc.

@sunit It appears that you are trying to change the number of parameters/arguments of a function after the differentiation operator has been applied to it. The operator (either D or diff) doesn't know what to make of that, and neither do I. What do you intend for it to mean? Why not first change the arguments, and then take the derivative?

For example, while it's true that the derivative of sin(x) is cos(x), it doesn't follow that the derivative of sin(2*x-y) is cos(2*x-y). Indeed, the latter derivative isn't even properly specified until we say the variable with respect to which the derivative is taken.

@sunit And what do you want it changed to?

@MortenZdk There's no need to load the Units package to do what you want to do. If you don't want to clobber the arithmetic operators, then just do:

restart:
eq:= 2.*Unit(m) + d = 5.*Unit(m);
solve(eq, d);

No knowledge of units is required to solve this equation. It's just pure algebra. And Maple will return the result with the units that you expect.

The purpose of overloading the arithmetic operators by loading Units:-Standard is that you may want to enforce unit consistency, you may want to do dimensional analysis, you may want to use equivalent yet differently presented units, etc.

As for units being a gimmick: The package's knowledge of unit systems seems comphrehensive, and there are many hooks for incorporating new knowledge.

 

@John Fredsted Just a wild guess: The OP's form explicitly shows that the function has the symmetry f(w) = f(1/w).

@taro No problem. The delay for the vote up button to respond is amazingly long. You often think that you haven't actually clicked it, so you click it again, which negates the first click!

Thank you for reminding me of the shorter (Diff = diff) form.

@MortenZdk I'm sorry that that didn't work for you. What Maple version are you using? I tested it in Maple 2016.

Obviously you intended for the above to be a Reply to Joe Riel's Answer to your previous Question: 'trasfer funtion plot tmdumper". Please copy it there.

@Vic You asked:

Do you think having them as lists is a bad idea?

Yes, given that you have millions of them.

should I use Array?

No, there's a better way.

Is there away that I could get the cartesian products one at a time and work on them without them taking up huge memory space?

Yes, indeed. It's called an iterator. In Maple 2016, it is handled by package Iterator. In Maple 2015, it can be done with a minor modification of the code I have above:

L:= convert(A, listlist):
J:= combinat:-cartprod(L):
to mul(nops~(L)) do

     j:= J[nextvalue]();
     if CheckCondition(j) then
          do_whatever(j)
     end if
end do;
 

 

@acer 

A difference between the subs method and the unapply method is shown when g depends on f and f depends on z. Both methods are immune to changes of f, but only the unapply method is also immune to changes of z, if z has an assigned value when g is defined.

Example:

z:= 1:
f:= (x,y)-> x+y+z:
g:= subs(_dummy= eval(f), x-> _dummy(x,1)):
G:= unapply(f(x,1), x):
(g,G)(1);

     3, 3

z:= 2:
(g,G)(1);

     4, 3

First 407 408 409 410 411 412 413 Last Page 409 of 711