-
February 27th, 2004, 11:15 PM
#1
One question, but wew I hope I can get many answers
Howdy ???
Very short and very easy question !!!! (easy to you, my Gurus)
Do you know how to decide whether 2 rational polynomials with n variables are equal ?
Thanks,
You Gurus , the great !!!
-
February 27th, 2004, 11:41 PM
#2
What is meant 'with n variables'? Do you mean polynomial of n-th power, or...
Code:
P(x0,...,xn-1) = Sum(0, n-1)(Sum(0,n-1)(a[i][j]*x[i]^j))
or
P(x)=Sum(0,n-1)(a[i]*x^i)
Anyways, you should check its coefficents.
-
February 27th, 2004, 11:48 PM
#3
Thanks,
and my next question is "how about Monte Carlo variety ?" I mean a kind of randomized algorithm.
-
February 27th, 2004, 11:49 PM
#4
You need to specify what you are talking about.
Is a rational polynomial, a polynomial with rational coefficients
or are you talking about a rational function, a ratio of polynomials.
Wakeup in the morning and kick the day in the teeth!! Or something like that.
"i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."
-
February 27th, 2004, 11:53 PM
#5
Originally posted by souldog
You need to specify what you are talking about.
Is a rational polynomial, a polynomial with rational coefficients
or are you talking about a rational function, a ratio of polynomials.
Oh well, all of them,
So, can you tell me all of such situations, I love to hear from you really very much.
Please tell me what I should do in each situation ??
Thanks
-
February 28th, 2004, 12:34 AM
#6
I don't even think they realized that you're trying to sneakily get them to do your homework.
-
February 28th, 2004, 05:41 AM
#7
Originally posted by kasracer
I don't even think they realized that you're trying to sneakily get them to do your homework.
Thanks,
but can you give me a hint to [underlined]my homework[/underlined] ??????
Thanks
-
February 28th, 2004, 05:51 AM
#8
I mean yes. that is homework but can you give me some solutions to that trivial homework ??
kasracer, I don't know who you are on this board but I read some of your posts posted by username<kasracer> and I find that you 've never given ANY specific solutions to ANY problems, I don't understand why you can keep your face straight like that ???????
Now can you tell me how to solve this problem ?????
I need to an algorithm to solve it in linear time O(n) or O(nlogn), can you give me one ???
Thanks,
-
February 28th, 2004, 07:02 AM
#9
Code:
#include <vector>
template <typename T>
class poly
{
std::vector<T> coeff;
public:
inline explicit poly(const size_t &n=5) : coeff(std::vector<T>(n)) {}
inline explicit poly(const std::vector &vec) : coeff(coeff) {}
inline explicit poly(const poly<T> &another) : coeff(another.coeff) {}
inline explicit poly(const T *pArr, const size_t &n) : coeff(std::vector<T>(pArr, pArr+n)) {}
inline bool operator==(const poly<T> &another)
{
return another.coeff==coeff;
}
inline bool operator!=(const poly<T> &another)
{
return another.coeff!=coeff;
}
bool evaluate(T arg, T &ret)
{
size_t n=coeff.size();
if(!n) return false;
ret=coeff[0];
for(size_t i=1;i<n;++i)
{
ret+=arg*coeff[i];
arg*=arg;
}
return true;
}
inline T &operator[](const size_t &i)
{
return coeff[i];
}
};
int main()
{
int coeff1[]={1,4,7,4,7};
int coeff2[]={1,4,7,4,7};
poly<int> p1(coeff1, 5), p2(coeff2, 5);
int s;
p1.evaluate(1, s);
if(p1==p2)
{
//stuff
}
return 0;
}
have fun
-
February 28th, 2004, 01:49 PM
#10
Originally posted by AppleGold
I mean yes. that is homework but can you give me some solutions to that trivial homework ??
We don't just give solutions to homework problems (you got lucky with AvDev). If you atleast try it, we'll help.
Originally posted by AppleGold
kasracer, I don't know who you are on this board but I read some of your posts posted by username<kasracer> and I find that you 've never given ANY specific solutions to ANY problems
Wow, you must really suck at searching. I try to help all the time and one of my last posts in the other C++ forum was a specific solution.
Originally posted by AppleGold
I don't understand why you can keep your face straight like that ???????
Yes my "face" is "straight".
-
February 28th, 2004, 06:37 PM
#11
Thanks Avdav,
edit: Kasracer!!! What were you talking about ? I mean what you meant by one of your last posts in other C++ forum ? What forum ? Tell me, I like to have a look at it .
Last edited by AppleGold; February 28th, 2004 at 07:16 PM.
-
February 28th, 2004, 10:29 PM
#12
Originally posted by AppleGold
Kasracer!!! What were you talking about ? I mean what you meant by one of your last posts in other C++ forum ? What forum ? Tell me, I like to have a look at it .
You said you searched moron. It isn't that difficult.
-
February 28th, 2004, 10:40 PM
#13
Originally posted by kasracer
You said you searched moron. It isn't that difficult.
Okay, Okay, cool man !!!
If you want to be UP, so I say you ae UP, okay,
didnt know the exact problem though !!!
-
February 28th, 2004, 11:30 PM
#14
I don't know about mathematical stuff such as this. I would appreciate it if you were to make the subject indicate what the question is about, so I don't waste time looking at questions I can't help with.
Also, I have doubts that this question is appropriate for the C++ forum. As far as I can tell, this is not a programming question. If so, then you must expect people to tell you to get out of here.
-
February 29th, 2004, 09:03 PM
#15
Originally posted by Sam Hobbs
I don't know about mathematical stuff such as this. I would appreciate it if you were to make the subject indicate what the question is about, so I don't waste time looking at questions I can't help with.
Also, I have doubts that this question is appropriate for the C++ forum. As far as I can tell, this is not a programming question. If so, then you must expect people to tell you to get out of here.
Thank you much for your mentioning what I should do to make it clearer.
You shouldnot doubt because I think I post at the right place,
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|