Manipulations of polynomials with lists
Here are my functions and structures, what does not work is the
derivative and value at the precise point void Derivee
,
float Valeur
. I work with lists, of course.
get_at(polyliste* p, int index ,float* coeff,int* deg)
typedef struct node* Node;
typedef struct node
{
float coeff;
int degree;
Node next;
} node;
typedef struct
{
Node head;
} polyliste;
polyliste create()
{
polyliste p;
p.head = NULL;
return p;
}
float Valeur(polyliste p, float x)
{
float s = 0, coeff;
int i = 0, degree;
while (get_at(&p, i, &coeff, °ree) == 0)
{
s = s + (coeff * power(x, degree));
i++;
}
printf("nLe resultat est : %f", s);
return s;
}
void Derivee(polyliste *p, polyliste *s)
{
int i = 0, degree;
float coeff;
*s = create();
while (get_at(&p, i, &coeff, °ree) == 0)
{
if ((coeff != 0) && (degree != 0))
{
coeff *= degree;
degree--;
add_first(s, degree, coeff);
}
i++;
}
}
c
|
show 4 more comments
Here are my functions and structures, what does not work is the
derivative and value at the precise point void Derivee
,
float Valeur
. I work with lists, of course.
get_at(polyliste* p, int index ,float* coeff,int* deg)
typedef struct node* Node;
typedef struct node
{
float coeff;
int degree;
Node next;
} node;
typedef struct
{
Node head;
} polyliste;
polyliste create()
{
polyliste p;
p.head = NULL;
return p;
}
float Valeur(polyliste p, float x)
{
float s = 0, coeff;
int i = 0, degree;
while (get_at(&p, i, &coeff, °ree) == 0)
{
s = s + (coeff * power(x, degree));
i++;
}
printf("nLe resultat est : %f", s);
return s;
}
void Derivee(polyliste *p, polyliste *s)
{
int i = 0, degree;
float coeff;
*s = create();
while (get_at(&p, i, &coeff, °ree) == 0)
{
if ((coeff != 0) && (degree != 0))
{
coeff *= degree;
degree--;
add_first(s, degree, coeff);
}
i++;
}
}
c
4
Welcome on stackoverflow, please take the tour and read this: How to Ask. Then you need to edit your question and provide a Minimal, Complete, and Verifiable example and an example of input and expected output.
– Jabberwocky
Nov 12 '18 at 8:13
add_first()
definition missing. Post a Minimal, Complete, and Verifiable example
– chux
Nov 12 '18 at 8:16
my program doesnt work , example of input 3X^2+2X+1 it would give me 6X+2
– Jihane.j
Nov 12 '18 at 8:16
Jihane.j, What is wrong with6X+2
? What is the goal?
– chux
Nov 12 '18 at 8:17
Perhaps it's time for you to learn how to debug your programs?
– Some programmer dude
Nov 12 '18 at 8:17
|
show 4 more comments
Here are my functions and structures, what does not work is the
derivative and value at the precise point void Derivee
,
float Valeur
. I work with lists, of course.
get_at(polyliste* p, int index ,float* coeff,int* deg)
typedef struct node* Node;
typedef struct node
{
float coeff;
int degree;
Node next;
} node;
typedef struct
{
Node head;
} polyliste;
polyliste create()
{
polyliste p;
p.head = NULL;
return p;
}
float Valeur(polyliste p, float x)
{
float s = 0, coeff;
int i = 0, degree;
while (get_at(&p, i, &coeff, °ree) == 0)
{
s = s + (coeff * power(x, degree));
i++;
}
printf("nLe resultat est : %f", s);
return s;
}
void Derivee(polyliste *p, polyliste *s)
{
int i = 0, degree;
float coeff;
*s = create();
while (get_at(&p, i, &coeff, °ree) == 0)
{
if ((coeff != 0) && (degree != 0))
{
coeff *= degree;
degree--;
add_first(s, degree, coeff);
}
i++;
}
}
c
Here are my functions and structures, what does not work is the
derivative and value at the precise point void Derivee
,
float Valeur
. I work with lists, of course.
get_at(polyliste* p, int index ,float* coeff,int* deg)
typedef struct node* Node;
typedef struct node
{
float coeff;
int degree;
Node next;
} node;
typedef struct
{
Node head;
} polyliste;
polyliste create()
{
polyliste p;
p.head = NULL;
return p;
}
float Valeur(polyliste p, float x)
{
float s = 0, coeff;
int i = 0, degree;
while (get_at(&p, i, &coeff, °ree) == 0)
{
s = s + (coeff * power(x, degree));
i++;
}
printf("nLe resultat est : %f", s);
return s;
}
void Derivee(polyliste *p, polyliste *s)
{
int i = 0, degree;
float coeff;
*s = create();
while (get_at(&p, i, &coeff, °ree) == 0)
{
if ((coeff != 0) && (degree != 0))
{
coeff *= degree;
degree--;
add_first(s, degree, coeff);
}
i++;
}
}
c
c
edited Nov 12 '18 at 10:04
G. Sliepen
2,379416
2,379416
asked Nov 12 '18 at 8:11
Jihane.j
15
15
4
Welcome on stackoverflow, please take the tour and read this: How to Ask. Then you need to edit your question and provide a Minimal, Complete, and Verifiable example and an example of input and expected output.
– Jabberwocky
Nov 12 '18 at 8:13
add_first()
definition missing. Post a Minimal, Complete, and Verifiable example
– chux
Nov 12 '18 at 8:16
my program doesnt work , example of input 3X^2+2X+1 it would give me 6X+2
– Jihane.j
Nov 12 '18 at 8:16
Jihane.j, What is wrong with6X+2
? What is the goal?
– chux
Nov 12 '18 at 8:17
Perhaps it's time for you to learn how to debug your programs?
– Some programmer dude
Nov 12 '18 at 8:17
|
show 4 more comments
4
Welcome on stackoverflow, please take the tour and read this: How to Ask. Then you need to edit your question and provide a Minimal, Complete, and Verifiable example and an example of input and expected output.
– Jabberwocky
Nov 12 '18 at 8:13
add_first()
definition missing. Post a Minimal, Complete, and Verifiable example
– chux
Nov 12 '18 at 8:16
my program doesnt work , example of input 3X^2+2X+1 it would give me 6X+2
– Jihane.j
Nov 12 '18 at 8:16
Jihane.j, What is wrong with6X+2
? What is the goal?
– chux
Nov 12 '18 at 8:17
Perhaps it's time for you to learn how to debug your programs?
– Some programmer dude
Nov 12 '18 at 8:17
4
4
Welcome on stackoverflow, please take the tour and read this: How to Ask. Then you need to edit your question and provide a Minimal, Complete, and Verifiable example and an example of input and expected output.
– Jabberwocky
Nov 12 '18 at 8:13
Welcome on stackoverflow, please take the tour and read this: How to Ask. Then you need to edit your question and provide a Minimal, Complete, and Verifiable example and an example of input and expected output.
– Jabberwocky
Nov 12 '18 at 8:13
add_first()
definition missing. Post a Minimal, Complete, and Verifiable example– chux
Nov 12 '18 at 8:16
add_first()
definition missing. Post a Minimal, Complete, and Verifiable example– chux
Nov 12 '18 at 8:16
my program doesnt work , example of input 3X^2+2X+1 it would give me 6X+2
– Jihane.j
Nov 12 '18 at 8:16
my program doesnt work , example of input 3X^2+2X+1 it would give me 6X+2
– Jihane.j
Nov 12 '18 at 8:16
Jihane.j, What is wrong with
6X+2
? What is the goal?– chux
Nov 12 '18 at 8:17
Jihane.j, What is wrong with
6X+2
? What is the goal?– chux
Nov 12 '18 at 8:17
Perhaps it's time for you to learn how to debug your programs?
– Some programmer dude
Nov 12 '18 at 8:17
Perhaps it's time for you to learn how to debug your programs?
– Some programmer dude
Nov 12 '18 at 8:17
|
show 4 more comments
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258074%2fmanipulations-of-polynomials-with-lists%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258074%2fmanipulations-of-polynomials-with-lists%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Welcome on stackoverflow, please take the tour and read this: How to Ask. Then you need to edit your question and provide a Minimal, Complete, and Verifiable example and an example of input and expected output.
– Jabberwocky
Nov 12 '18 at 8:13
add_first()
definition missing. Post a Minimal, Complete, and Verifiable example– chux
Nov 12 '18 at 8:16
my program doesnt work , example of input 3X^2+2X+1 it would give me 6X+2
– Jihane.j
Nov 12 '18 at 8:16
Jihane.j, What is wrong with
6X+2
? What is the goal?– chux
Nov 12 '18 at 8:17
Perhaps it's time for you to learn how to debug your programs?
– Some programmer dude
Nov 12 '18 at 8:17