Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are replies submitted by Carl Love

What do you mean by iota? Do you mean sqrt(-1), which is what I usually means in Maple? The expression is already as simplified as it can get. Do you mean that you want to expand it into sin and cos terms? Then do evalc(f) assuming s::complex;

You'll need to provide *a lot* more detail than that before your problem will make sense to us.

@Markiyan Hirnyk Where do you see age 4 mentioned? The header of the linked page says "For honors math students entering grades 6, 7, or 8."

Maple syntax allows the expression seq(F, n= 0..n) (where F is an expression depending on n); however, I think that most serious Maple coders would find it abominable to use the index in the bounds.

Your code is equivalent to the following, which I find much easier to read/understand:

restart:
(a,b,c):= (1,2,3):
(-1)^a*b!*(a+c)!*add(binomial(c,n)*(ln(2)+add((-1)^(a+k)/(a+k), k= 0..n)), n= 0..c);
tot:= evalf(%);

I don't really understand your Question, but the above simplified code may provide you with some insight into your problem. If not, try to rephrase the Question. (Note that I'm not claiming that my code above solves your problem. As far as I can tell, my code produces exactly the same final results as your code. It's just that it's easier to understand.)

 

@Preben Alsholm Clearly I was wrong about the limitation to first order in time. Now I wish that I could remember the actual limitation that I discovered.

@Kitonum Thanks. It's now corrected.

@Preben Alsholm I believe (not sure) that pdsolve(..., numeric) will fail on any attempt to fake an elliptic PDE into something time based and that it'll fail on any PDE that isn't first-order in time.

@JacquesC Indeed, your Reply above just triggered an email notification to me because I must've participated in this thread, but my post isn't now shown below!

@dharr Actually, the extra digits are not needed to perform the arithmetic. The real reason that high Digits works around the problem is that it forces the use of software floats. If we use software floats and keep Digits low, the arithmetic still works, as in

Digits:= 10:
eval(
     .1126460951*t-0.7049523744e-1-1.090463096*10^1390*exp(-1.597924898*t),
     t= 2000.5
);
      168.9538494

@fzfbrd Your worksheet contains the line

CrssOfVds:= VDS-> ArrayInterpolation(Vds, Crss, V);

This line is erroneous because VDS doesn't occur on the right-hand side of the arrow. (The line is not a syntax error because one is allowed to define a constant function, i.e., a function that doesn't depend on its parameter(s).) This line should be

CrssOfVds:= VDS-> ArrayInterpolation(Vds, Crss, VDS);

as it was in your Reply to my Answer below. If you claim that having it that way causes the subsequent evalf(Int(...)) to throw the error

invalid input: evalf expects its 2nd argument, n, to be of type posint, but received numeric,

then please post an executed worksheet showing that error.

@shoeless You wrote:

While the int() command gives me an (expanded) symbolic solution, the same command placed into a function definition will not :/ Seemed odd, e.g. HIG:=T->int(); Any idea why?

Do you mean Why doesn't the command HIG:= T-> int(cos(T), T) return HIG:= T-> sin(T)? The command is a function (more properly called a procedure) definition, not a procedure invocation. No expression in the procedure's body or header is evaluated until the procedure is invoked (*footnote), i.e., a value is supplied for T. In the case of this procedure, that value may simply be the global name 'T'. But this isn't the usual case. For example, it may be required that T be a number rather than a name. But, of course, a name is required to form the abstraction of a procedure parameter.

If you want an expression to be first evaluated (simplified, expanded, etc.) and then turned into a procedure, then use unapply:

HIG:= unapply(int(cos(T), T), T);

 

(*footnote) There is a minor exception: Trivial arithmetic and some very trivial algebra will be done via a process referred to in the Maple documentation as automatic simplification. An example is that A^0 will be replaced by 1.

@fzfbrd I don't understand why you're getting that error message. It seems to think that you are giving the command

evalf(Int(CrssOfVds, Vdson..Charge_Vds), numeric)

which would be erroneous.

Try using restart, and change ArrayInterpolation to CurveFitting:-ArrayInterpolation.

@tomleslie The reason for the phenomenon that you observed is that the garbage collection runs multithreaded even if the primary code doesn't. You can turn off this feature (so that you can properly time test your code) by setting kernelopts(gcmaxthreads= 1).

I know that you must be excited about your new computer and fully utilizing all of its cores, but please don't be so quick to yell "Bug!" so vehemently.

Note that cos is not "threadsafe" (see ?index,threadsafe), so results are unpredictable.

Please run the following command:

kernelopts(numcpus);

If the result isn't 20, just report that result. If the result is 20, then please run the following test code and report the results. You should have 20 seconds with which to observe whether you're getting nearly 100% CPU utilization.

Waste:= proc(N)
local st:= time();
     while time() - st < N do end do;
     kernelopts(numactivethreads)
end proc:

CodeTools:-Usage(Threads:-Map[tasksize= 1](Waste, [20$20]));

The expected results are a cpu time a little over 400, a real time a little over 20, and a list of 20 20s.

Please upload a worksheet (as an alternative to copy-and-paste). Use the green uparrow, which is the last item on the second row of the toolbar in the MaplePrimes editor.

First 465 466 467 468 469 470 471 Last Page 467 of 709