7 Reusable Code Snippet Topics

Remove Filter
Member Avatar for
Member Avatar for ddanbe

Short snippet in C# to do this classic trick, I could not find one on the web. Little, (even none!) error checking is done here.

Member Avatar for ddanbe
0
849
Member Avatar for Gribouillis

This snippet shows how to find the complex roots of a polynomial using python (tested with python 2.6). You need the scipy or numpy module.

Member Avatar for Gribouillis
2
3K
Member Avatar for iamthwee

Here is a simple Polynomial class. Its purpose is to show how one can [B]simply [/B]create a Polynomial class without using abstract datastructures such as linked lists etc. Each term is printed out in order of its power - from highest to lowest. Inspiration was taken from a Java source …

Member Avatar for parisa_hr
2
14K
Member Avatar for ddanbe

Don’t know if this is ever been done before, or even if it is a good way to do it. I’ll just await your comments if any. What I mostly found on the web is that if you want to define a polynomial you need to have an array containing …

0
444
Member Avatar for DavidB

Here is my first Code Snippet contribution: a C++ sub-routine that computes the roots of a quadratic equation. Notes: * This sub-routine checks if a = 0. * IF a = 0, then the equation is actually not a quadratic equation; it is a linear equation with one--if any--root. * …

Member Avatar for DavidB
1
711
Member Avatar for TrustyTony

There was discussion thread http://www.daniweb.com/software-development/python/threads/424953/polynomial-division for class based implementation for polynomials, and I developed a version utilizing the magic methods to enable operation with normal arithmetic operation. I only inherited sequence structure from list type. Interoperability with scalar types is not implemented to avoid too complicated type checks of the …

Member Avatar for TrustyTony
1
1K
Member Avatar for TrustyTony
Member Avatar for Gribouillis
1
723

The End.