## 55 Reputation

5 years, 342 days

## Use diff and not D...

@Christian Wolinski I changed the P function to the following:

subs({x=x0,y=y0},diff(f(x,y),[x\$(n-k),y\$k]))*
(x-x0)^(n-k)*(y-y0)^k, k=0..n), n=0..N)

and I get a remarkable improvement

New timings for the procedures:

• Using D: 14 sec
• Using diff and subs: 0.04 sec
• Using mtaylor: 0.008 sec

## @Christian Wolinski Thanks for your...

@Christian Wolinski Thanks for your effort. Your procedure is faster, but it does not return the correct answer.

You get many more terms, and the result does not evaluate to the same value:

Your procedure involves negative powers as well

## built-in functions vs programming tips...

@vv sure, for most types of problems it's better to use built-in functions, but want to know if there are any obvious pitfalls to avoid when defining your own.

E.g. it was just yesterday that I found the mtaylor function, nor did I know of the series function before reading your answer.
Also, reading the documentation for the series function, most people would probably disgard it as being for single-variable functions.

Sometimes you just want to do something quickly, and you don't know that there are built-in procedures for it.

@acer thanks. Now it works beautifully

## @vv I like this. Consise and i...

@vv I like this. Consise and illuminating

@acer Thank you, thank you, thank you :)

## How to extract the singular values...

@vv Hi. Thanks for your answer. I think you know Maple pretty well, and you might be willing to give additional help.

The output from the singular command, is something like {z=p1}, {z=p2}, ... (are these sets ?).
How can I extract the actual values to put them into the residue command directly (without using the add function)
If I do

p := [singular(f(z), z)]   // get something like [{z=p1}, {z=p2}]
residue(f(z), p[1])        // invalid input, 2nd argument should be name=value

then it fails. How can I extract the expressions from the curly-braces. E.g.

expr := "somecommand"(p[1])      // I want p1 to be the expression 'z = p1'

## lists vs sets...

@acer thanks. I thought I tried first using lists for both the functions and colors, but apparently I did not because now it works fine, specifying both as lists

## @Thomas Richard I tried, but I have...

@Thomas Richard I tried, but I have not yet obtained a reputation high enough...

## @Thomas Richard  Great. Thanks. Thi...

@Thomas Richard  Great. Thanks. This is my first time on this site. Do we accept answers similarly as the stackexchange sites ?

 Page 1 of 1
﻿