473,605 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c++ adding 2 polynomials

2 New Member
hello i am angela and i would like if its kind of anyone to help me by writing me the code of adding 2 oplynomials?

polynomials should be entered as [3x4+5x3+X] where 3,5 and 1 are coefficients of X to the power 4,X to the power 3 and X to the power of one.

mostly appreciated
Jan 8 '07 #1
1 3552
vpawizard
66 New Member
Hello,
Following is the psuedo-code:

int coef1[10];
int coef2[10];

The index denotes coefficient of power n. e.g.3x2+2x1+1 will stored in array as:
coef1[2]=3;coef1[1]=2;coef1[0]=1;
Similarly for second polynomial.
Then, corresponding element in each array is added to get the addition of two polynomials.



Regards,
Jan 8 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1715
by: Chris | last post by:
Does anyone know of a good standalone implementation of multivariable polynomials in python? Thanks, Chris
9
1578
by: Ross Olney | last post by:
Im starting a program that is supposed to take in polynomials from the user. From there they can add them, subract, multiply, or divide them. My question is more of the design. What would be a good way to design it be? I have a polynomial class and the only way Ive figured out to do this is put in add, subtract etc functions into the polynomial class and pass one polynomial to the other. But that doesnt seem very good. Seems...
7
4460
by: adrin | last post by:
hi, anyone knows how does an algorithm for calculating GCD of two polynomials look like ? please help me if you can, or give some relevant links :)
2
2472
by: dicapryl | last post by:
Hi all! I'm new to here .. so please excuse me if my questions are unclear etc :) I am trying to store polynomials in C++ using linked lists. My class is called Polynomial and i've created a structure that represents each term in the polynomial (a node in the linked list). A node is called 'term'. However, I am having a problem visualizing how to link all these 'term's together to create a 'Polynomial' that i can actually call. I can add...
0
1118
by: galathaea | last post by:
you will fall in love !! these are the cutest critters !! 3-ary polynomial: http://i10.tinypic.com/2hwlir6.png 4-ary polynomial: full http://i13.tinypic.com/47u0yfm.png
4
4634
by: Matthias | last post by:
how do i make a program that gets numbers from a user. and then stores it into an array. using polynomials if the user entered 7 5 4 3 2 the polynomial would be 7x^4+5x^3+4x^2+3x+2 the program would then ask for a value of x, and solve it. i think i got an idea how it would store plain old numbers into an array. but not sure how it would store a polynomial into an array. does anyone have any ideas?
7
13943
by: yodadbl07 | last post by:
hey im trying to write a class of polynomials using a linked list. But I am getting an error at run time with my Polynomial* getNext() function. The error says access violation reading location. Im not sure what im doing wrong. #ifndef POLYNOMIAL_H #define POLYNOMIAL_H class Polynomial { public: Polynomial( ){} Polynomial(int theCoefficient);
2
1764
by: manohara | last post by:
WAP a program to add 2 polynomials using a DLL
1
2257
by: Motanyane Tlotliso | last post by:
I wish someone to help me in creating a programm in C++ that can be able to sum two polynomials, subtract one from the other and multiply both polynomials together using a ADT's(struct term). I have to submit such a program on the 15 November at 5pm. I will be happy if someone could send me a running Program named above. Tlotliso Motanyane
0
8001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7934
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8424
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8415
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5445
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3958
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.