You're calling int() with the wrong syntax.
It should be,
int((4*x-3)^3, x);
and not,
int((4*x-3)^3, dx);
Using the correct syntax, you should get the right answer straight away.
If you'd like to try the change of variables anyway, just for fun, it can be done as follows.
First, step by step,
P:=Int((4*x-3)^3, x);
Pu:=student[changevar](u=4*x-3,P,u);
pu:=value(Pu);
eval(pu,u=4*x-3);
Or, in one single line,
eval(value(student[changevar](4*x-3=u,Int((4*x-3)^3, x),u)),u=4*x-3);
acer
This raises several interesting questions.
How can one create a variable which gets dislayed with a long overbar as 2D Math input but which does not have any of the mathematical meaning of conjugation?
It should be clear that sometimes one will want both foo and \overbar{foo} without a relationship between them of conjugation. One approach is to convert the input object, which underneath the hood is actually conjugate(foo), into a unique variable with no relationship or mathematical connection to variable foo. This can be done inplace on the input using the context-menu choice 2-D Math -> Convert To -> Atomic Identifier.
Does the conversion to atomic identifier (unique variable name, independent of name foo) need to be done each time the variable is entered as input? Apparently it usually does. Copy & paste of overbar output wipes out the atomic identifier aspect, getting back to conjugate().
Programmatically, one can also enter something like `#mover(mi("foo"),mi("_"))` to get a unique name, independent of name foo, which gets displayed as output with an overbar. This is not as nice as LaTeX syntax. Also, how can one use this to get an atomic identifier which gets actually typeset as foo overbar for input?
Notice the two Layout palette entries whose hover-over bubble help are "over" and "over2". The first produces a conjugate() object. The second entry, "over2" can sometimes produce an atomic identifier, it seems. So, I tried using the "over2" entry. For the upper part, entering a minus sign, ie. - , produced something with an unfortunately short bar. After selecting palette entry over2 I also tried the keystrokes,
foo\_
but this just produced an object which was conjugate(foo) in nature and also showing with the short overbar as input.
Wouldn't it be more appropriate if the "over" entry instead had bubble help stating "conjugate", and if the "over2" entry instead had bubble help something like "overliteral".
I couldn't find a way to get a long bar for the 2D Math input, as there can be for the 2D output of the same object. Is there a way?
How can one discern whether a 2D typeset object (input and output) is an atomic identifier or an instance of conjugate()? Is there something easier than lprint?
Maple 11.00, Linux.
acer
It should be possible to "fix up" the pie chart after the fact, using Maple itself. The pie chart gets created as just another PLOT structure, and hence should be subject to programmatic manipulation.
For example,
restart:
with(Statistics):
p:=PieChart([Wales = 40, Unknown = 56, GB = 341, E = 237, RUS = 31, D = 93, F = 91, IRL = 39, S = 35, Other = 244], color = orange .. green):
newp:=subsindets(p,specfunc({list,identical("Wales")},TEXT),f->subsop([1][1]=[op(1,f)[1]+0.5,op(1,f)[2]],f)):
plots[display](newp);
It should be possible to construct a maple procedure that moves all the captions away from the centre and outside the unit circle. One could likely make such a procedure reusable, for other pie charts.
acer
What do you mean by good quality random numbers?
Do you mean that they have to pass some statistical tests? For example, something like the
diehard tests?
Or perhaps you intend to use these numbers in some sort of simulation, perhaps as entry values for some Monte Carlo computation. Maybe a strict battery of tests isn't what would serve you best? Perhaps all that you actually need is that the numbers, entered into some simulation, provide an unbiased estimator for the result of your particular computational goal?
acer
I suggest asking your lattermost questions, about fast complex numerical computations, on the usenet newsgroup sci.math.num-analysis .
acer
See the help-page ?type,series for an explanation of the series datastructure. That datastructure is quite different from the explicit sum of terms in your s.
See ?convert,polynom for examples of converting a series object to a polynomial (SUM).
acer
Yes. If you are on Linux/UNIX, the bin/maple script acts like this:
maple -x <- Std Java GUI
maple -cw <- Classic GUI
maple <- TTY interface
On Windows, the TTY interface is named cmaple.exe , I think. It can be started from a DOS shell, or from a cygwin bash.
Also, you spoke before of computations that take longer according to some bracketing. I assume that means that you are using the Std GUI. If so, try it in "worksheet" mode with 1D maple notation input instead of Document mode with 2D Math input. You can select the mode, Document or Worksheet, from the File drop-down menu. And in the Options menu you can configure which you want as default (mode, and entry style, etc).
acer
Is this the sort of thing that you're after?
sys := {diff(y(x), x) = x, y(0) = 1}:
sol0 := dsolve(sys, numeric, output = listprocedure):
s := subs(sol0, y(x)):
s(1);
SS := proc(t) global s;
if type(t,numeric) then s(t) else 'procname'(t);
end if;
end proc;
sys2 := {diff(U(x), x) = SS(x), U(0) = 1}:
sol1 := dsolve(sys2, numeric, output = listprocedure, known=[SS]):
s2 := subs(sol1, U(x)):
s2(1);
It seemed that this also worked,
sys2 := {diff(U(x), x) = 's'(x), U(0) = 1}:
sol1 := dsolve(sys2, numeric, output = listprocedure, known=[s]):
acer
If you set infolevel[LinearAlgebra]:=2 then you will see that external compiled routines are already in use. The names appear to be NAG function names, each equivalent to some BLAS name, according to NAG online docs. Experience with performance testing shows that these must be linked to fast 3rd party BLAS, ie. ATLAS.
Consider this internal routine:
kernelopts(opaquemodules=false);
showstat(LinearAlgebra:-LA_Main:-`MatrixExponential/complexfloat`);
It is all Matrix functions to do multiplications, norms, and additions, in NAG/BLAS calls.
I have some edits to the original posting, which cut out some copying and maple library function call overhead. But after a certain extent, further optimization is difficult.
For example, one could take that internal routine and squeeze it. By calling it directly, a few more function calls could be avoided. Also, look at how it uses temp1 and temp2. It only ever Copies data into them, and so keeps maple from creating any unnecessary Matrix garbage. It might be possible to make its temp1 and temp2 global instead of local, so that they get re-used for each exponential computation. Using private workspace is an extreme optimization step (acknowledging that maple's rtable memory management can be bettered in special cases).
One could also do it in C, and link to it. But the objective to work entirely at the maple library level is appealing.
Let me cut n' paste my code edits, in a followup. I found this problem instructive.
acer
Are the Matrix entries exact quantities (integers, rationals, symbolic quantities with exact coefficients, etc) or approximate floating-point values (7.3, etc) ?
It makes a difference, as to what is a good way to compute the rank. If the entries are floats, then a singular value decomposition would do. If not, then row reduction and counting the non-zero rows could do. It might depend on whether you are, say, taking a class in numerical analysis or basic linear algebra. I'd first guess that it's the latter. But I thought that I'd check.
acer
Could you upload the Matrix example? It's more difficult to discern what's happening without it.
acer
Can you not use limit(Opl,hoekvers=2*Pi) ?
That's just a thought. You might also temporarily change the division-by-zero default numeric event behaviour, see ?NumericEventHandler
acer
Do Ctl-t, Ctl-m, and Ctl-r work for you, to switch to text, 1D maple input, and 2D Math input modes respectively?
acer
Why use all the heavy machinery of function-creation, to do a mere evaluation of an expression? It's not known whether the procedure will do evaluations of the expression at many points, or whether the procedure itself might be called for many distinct expressions. One could probably construct examples where each were "worthwhile".
Argument checking is good to add, of course. Almost every example procedure posted here on mapleprimes could do with more robust validation of arguments. A user who does not understand that an expression is not a maple function probably will find the simplest example most clear to begin with.
My point was that using eval() is likely what the poster should use here, as opposed to subs(). And I would suggest that the original poster appeared unclear as to whether x^2 were an expression or a function. It is good of the first responder to show the difference, as far as evaluation goes.
acer
That second approach is so much better than the first, djc, if I might offer an opinion.
Consider that Sandor used the term "function", and yet the example clearly shows an expression not any function. Indeed, if he had not used the term function, you might well have not considered that first solution at all. :)
And good job on using eval(). There's been a bit too much suggestion to use subs(), when 2-argument eval() is what's called for, around here. It does appear that Sandor is after mathematical evaluation, and not substituton into a structure.
acer