Mac Dude

1167 Reputation

16 Badges

8 years, 51 days

MaplePrimes Activity


These are answers submitted by Mac Dude

One way is to eval your series:

eval(series(...),g='x->x^2+1'); # note the uneval quotes

which returns

This is of type series, to make it a normal expression use

convert(serr,'polynom');

to get rid of the O(x^4) part.

M.D.


Well, there is the Maple Programming Guide; an excellent document describing Maple programming in detail. I learned a lot from it and still use it for reference when needed.

As for editing, I suggest looking into the maplev Emacs module by Joe Riel. This gives you syntax coloring, indentation and such. You edit a .mpl file with Maple code; that you then read into the worksheet to execute it. Or, if you don't need the graphical aspects of Maple's GUI, you can run it directly from emacs using the command-line version of Maple. What I personally do is to put code of any length or significance into a package edited using emacs/maplev an then read the package & save it as .mla file using LibraryTools.

A debugger is available in the standard GUI. stopat(routineame) will bring it up.

M.D.

Well, it depends on what you want. taylor is the Maple function for Taylor expansion by a single variable, and the use is straightforward (for up to first order (linear)):

xpr:=F(x,y+q,G(x+q,z) );

taylor(xpr,x,2);

taylor(xpr,y,2);

taylor(xpr,z,2);

The results are in a series form; use convert(s,polynom) (where s is one of the above results) to make a normal expression (polynom) out of it.

If you want the expansion in all three variables, use mtaylor:

mtaylor(xpr,[x,y,z],2);

and note that mtaylor returns a normal expression, not a series.

series() is a more general expansion procedure in Maple. mseries does not exist, but is possible to program.

It's all in the Help files. They also explain the derivative operator Dn. Use them.

M.D.

 

 


It appears this has only the trivial answer (everything is 0). I worked this along the lines of using solve and eliminate repeatedly and one runs into infinities sooner or later. See the attached sheet.

M.D.

equations.mw

About a year ago I wrote myself a little package that can model RC, CR and LRC circuits. Please see the attached. I also attach a test file that should demo its use. Actually, I don't as MaplePrimes refuses to let me upload a 2nd file. WTF?

HTH,

M.D.

Filters.mw

 

 

If, by math type software you are referring to MathType, the "full", paid-for version of the Equation Editor that has been arund for a long time in MSWord, then you can select a Maple output string, copy as MathML and paste it into the MathType window. It'll need some post-editing but you'll get reasonably close.

If you use actual LaTeX, the string Maple produces needs to be embedded in math mode. You would usually put this into a LaTeX document at the right position and put it into an equation environment. In my experience the LaTeX code is not very efficient but it should typeset. I often manually clean it up. If you don't use LaTeX these terms will be meaningless to you and you should use a different mechanism to get your output into Word. Maple supports RTF and HTML. I don't know whether these are sufficient for you; if you do heavy math they may well not. Maple lso supports export as pdf... I have no clue what that does. The Help facility has a number of pages dealing with this; search e.g. for format.

Send an example if this answer doesn't help you.

M.D.

use "assuming a>0", then it works (the result is too large to show here). It appears this integral diverges for a=0.

M.D.

Edit: Ninja'd by Mariusz

I assume you need to show this explicitly. I'd do it like this:

restart;
f:=x->3*x^3-2*x^2+5*x-7:

f(x+h)-f(x);
note: only the numerator in the differential

factor(%);

at which point you can see that the division by h just removes the common factor and you can eval the rest for h=0 yielding the result:

%/h;

eval(%,h=0);

 

I hope this helps,

M.D.

 

MathType is indeed te way to go. You copy the Maple output (from the Standard Notebook Interface) as MathML and paste into a MathType document. The result may need some manual touching up but the basics are there.

It does appear that MathType has been sold to a new outlet & now is subscription based. This makes it expensive if you have the odd need only. On the other hand, development had mostly stopped so maybe this will end up being a good thing.

Your alternatives are screen dumps to a TIFF or PNG file & paste it in; or, as rlopez suggested, do a round trip via LaTeX (and figure out how to get that into Word).

M.D.


Your solution is to use evalf (no h before the f) instead of evalhf. IIRC evalhf is not able to do lexical parsing, which in this case means it cannot find the member (or property) of a module. If you really, really need to use evalhf you may be able to assign to a local variable and call evalhf on that.

As for restart, Maple does not allow restart within a proc or module. It is very hard to see why you would ever want to do that (and for nested calls, where should Maple restart from??). So get rid of it. Use error "message" to catch any error comditions.

Mac Dude

I believe what you are looking for the the error of the parameters. I ran into a imilar issue years ago and wrote a variance routine that does this to firt order. See the attached Mape worksheet. Read up on how to use the matrix in Statistics:-Linearfit.

M.D.

VaarianceCovarienceMatrix.mw

You use phi in two ways: once as a scalar (phi) and once as an element of a table (phi[c]). Maple does not like that. If you aim for phi[c] is just to get a subscript in the output you can use phi__c (double underscore) in not-too-old versions of Maple, which remains a simple name (atomic) and avoids this confusion. You have other cases of using indexed names; they look ok but be aware that to Maple beta[k] is an element of table beta. If you assign a number to k then beta[k] becomes something different. The table in Maple is an associative array, so k or c in this case act as the keys.

M.D.

Carl already commented on your statements.

I would like to add the suggestion for you to read and peruse the Maple Programming Guide that you can download from Maplesoft's website. It has in-depth descriptions and examples of programming with modules and procs; I found it indispensable when I got into programming with modules.

You ask about the difference between modules and procs. I would say a module is a bit like a class in object-oriented lingo. It has methods (procs) and properties (exports). Think of it as a container. A module does not get called and had no parameter list. The two uses of modules I encounter most often are for writing packages (module() option package; ...; end module;) and in the so-called "module factory", where a proc returns a module with its own procs and properties, thus allowing to create multiple instances of an object.

Maple modules are powerful and fascinating. But it took me a while to really understand how to use them; be prepared for a learning curve to climb.

Mac Dude

Your first piece of code is syntactically incorrect. f3 is in output format.

Fixing that, still no solution, because you don't have enough Digits. Increase Digits to 40 and you get a solution. Whether it is correct or not I cannot tell (n not being an integer makes me suspicious).

M.D

equations.mw

Maybe the trickiest part is the creation of A:

n:=3:
A:=Matrix(n,n,(i,j) -> piecewise(i=j,0,1));

as this is not well documented. Then it is smooth sailing using the LinearAlgebra package:

LinearAlgebra:-Determinant(A);
2

LinearAlgebra:-CharacteristicPolynomial(A,lambda);

LinearAlgebra:-Eigenvectors(A);

Read the docs for the LinearAlgebra package to understand how to use it.

One deficiency of Maple is that it does not deal with abstract matrices (or vectors, for that matter) of arbitrary dimension. I.e. n has to be defined, else the Matrix constructor throws an error. So you will need to write a loop or otherwise solve the problem explicitly for the 3 cases.

M.D.

1 2 3 4 5 6 7 Last Page 1 of 18