32 Topics

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
847
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 Yugalpsd

need a program to perform polynomial division with linked lists or arrays. i already tried multiplication,subtraction and addition but stucked in division can anyone help me out on this.

0
147
Member Avatar for ddanbe

Hi, in my polynomial class all the terms consist of a List of tuples (double, uint), representing the coefficient and the exponent; a real and a natural number. The +operator implementation works great, but I was wondering if I could avoid to write two times `grouping.Sum(s => s.Item1)` It somehow …

Member Avatar for ddanbe
0
234
Member Avatar for javalearner1

I wrote this code for mutipicate two polynomials but I want change it as it can get two polynomials and then multicipate them for example: input: 5x -2x^2 +x -1 -4 -2x output: 4x^3 -4x^2 -22x +4 public class Polynomial{ public int[b+1]; coef[b] = a; deg = degree(); } // …

Member Avatar for sara12234
-1
234
Member Avatar for eldiablo1121

Hello, I have to write a program that will solve polynomials by user input, my program compiles, but gets an exception error. Here is my code: import java.io.*; import java.util.Scanner; import java.util.LinkedList; public class PolynomialList { private Node first = new Node(0, 0); private Node last = first; private static …

Member Avatar for JamesCherrill
0
1K
Member Avatar for Labdabeta

Hello, I have used taylor polynomials to approximate floating-point values before. I am wondering whether there is a way to still apply them to functions with complex arguments, and if there is a way what its constraints would be. For example, to calculate the sine of a floating-point number to …

Member Avatar for ddanbe
0
247
Member Avatar for bradley1234

I want to make two polynomials and then add them. We have two lists, [1,2,0,3] and [2,3,0,0,1]. The polynomials are as followed: 3x^3+2x+1 and x^4+3x+2. I have the following code, but I'm getting stuck. Any advice? I'm new to python. def polyAdd(poly1,poly2): for i in range(len(poly1)): z = poly1[i] return …

Member Avatar for vegaseat
0
197
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 germainelol1

I am creating a method to multiply 2 polynomial expressions together such that: `3x^5 * 2x^3 = 6x^8` -> Where the coefficients are multiplied and the exponents are added together. My test case for this would look something like the following @Test public void times01() throws TError { assertEquals(Term.Zero, Term.Zero.times(Term.Zero)); …

Member Avatar for NormR1
0
331
Member Avatar for germainelol1

I have a Java class called Term holding polynomials like below public Term(int c, int e) throws NegativeExponent { if (e < 0) throw new NegativeExponent(); coef = c; expo = (coef == 0) ? 1 : e; } I also have an equals method in the same class like …

Member Avatar for JamesCherrill
0
495
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 mochiboo5

Hi everyone, this is my first post and I am new to C++. I am trying to figure out how to do this project. Newton’s method is an algorithm that can be used to solve an equation of the form f(x) = 0 using a sequence of approximations. Here’s how …

Member Avatar for DavidB
0
3K
Member Avatar for mochiboo5

Newton's Method to find polynomial solution Hi everyone, this is my first post and I am new to C++. I am trying to figure out how to do this project. Newton’s method is an algorithm that can be used to solve an equation of the form f(x) = 0 using …

Member Avatar for mochiboo5
0
308
Member Avatar for kace91

Hello to everyone! This is my first post here, I hope you can help me. I'm making a class work in python and I'm a little lost: I have to use classes to represent monomials and polynomials, and the classes should contain methods to add, substract, multiply and divide them. …

Member Avatar for TrustyTony
0
2K
Member Avatar for Bradoz

Hello problem i am having is when trying to multiply polynomial 1 by polynomial 2 polynomial 1 gets mutliplied by the first term in polynomial 2 and not by each term in polynomial 2. Below is my code: ~~~~ /********************************************************************************************* * Multiplies Polynomial 1 to Polynomial 2 * The method …

Member Avatar for NormR1
0
311
Member Avatar for userct

I need to Compute 2x4 +7x3 -15x2 +3x+2 Using Horners Method. When I run this in QTSpim it doesn't give me any errors but I'm just wondering if everything is running completely right. For instance did I call "x" correctly? I'm trying to load the value for x from memory …

0
143
Member Avatar for mastdesi

I have to do my first assignment for my java class for friday this week. So due in 3 days. I wrote the polynomial class but haven't done the driver for it yet as i don't know if my polynomial class is good. Please check and let me know if …

-1
134
Member Avatar for bbyynn

Hi all, I just make a program and I get in trouble about set method.so anyone can help me? [CODE] import java.util.LinkedList; public class Polynomial { private LinkedList<Integer> coeff = new LinkedList<Integer>(); private int deg = 0; /* Constructs a new polynomial of degree zero */ public Polynomial() { } …

Member Avatar for peter_budo
0
187
Member Avatar for arunkumar267

#include<iostream> using namespace std; class polynomial { private: struct p { int degree; float coefficient; p *link; }*head; public: polynomial() { head=NULL; } void getdegree(); void getpolynomial(int d); void display(); void addition(polynomial p1,polynomial p2); }; void polynomial::getdegree() { int degree1; cout<<"\n Enter the highest degree of your polynomial:"; cin>>degree1; getpolynomial(degree1); …

Member Avatar for arunkumar267
0
281
Member Avatar for iamuser_2007

hi in my text book i have this problem. how to program this [ICODE] Define a class Quadratic_int that stores the coefficients of a quadratic polynomial in a dynamically allocated array of integers. Supply the "big three" memory management functions. Use this class to demonstrate (a) the difference between initialization …

Member Avatar for sergent
-2
189
Member Avatar for manny23

[CODE]ifndef POLY_H #define POLY_H class Poly { public: Poly() : first(0) { } void addTerm(double coeff, unsigned exponent); // add term (coeff^exponent) to the polynomial; // might just change coefficient of existing term, // or might insert new term; maintains terms // in order from greatest to least exponent private: …

Member Avatar for mrnutty
0
139
Member Avatar for Climber Ty

So this is my final project for my class. The idea is to use my RationalNum class (which is complete and works fine... I just didn't attach the .cpp since it was only the driver) and use it to add, sub, & multi polynomials (RationalNum being the coefficients i.e. 1/4x^3 …

Member Avatar for Climber Ty
0
471
Member Avatar for AnthonyJ

I have an assignment where I need to do some operations on polynomials (add, multiply, ...) which are represented by linked lists. Part of the assignment is to make an inner class Term containing two int fields and a constructor with coef and exp ints) I also need an inner …

Member Avatar for JamesCherrill
0
380
Member Avatar for mindx

Polynomial hash code in hashing is used to convert character strings to numerical values. Use Horner’s rule to implement this algorithm, and also perform the character conversion using ASCII format. Conduct experiments to study the collision rates for this hash code by using different values (prime or non-prime numbers) for …

0
90
Member Avatar for keweul

[CODE] #ifndef POLYNOMIAL_H #define POLYNOMIAL_H class Polynomial { public: Polynomial(); Polynomial(int ,int []); ~Polynomial(); const Polynomial operator+(Polynomial& p) const;// addition const Polynomial operator- (Polynomial& p ) const; // subtraction int getExponent(); //void setExponent(); void setCoefficient(); int getCoefficient(); void printPolynomial(); private: int exponent; // exponent int coefficient[ 10 ]; // coefficients …

Member Avatar for cppgangster
0
4K
Member Avatar for TrustyTony
Member Avatar for Gribouillis
1
722
Member Avatar for crodriguez08

Hey there, I'm having trouble creating a multiplication function for the program as I have two classes to keep in mind (Monomial and Polynomial). And if possible, a little advice on how to make my for statements in the arithmetic operators more flexible to user input such as i<PolynomialSize, which …

Member Avatar for crodriguez08
0
1K

The End.