powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Программирование [игнор отключен] [закрыт для гостей] / differentation using C++
5 сообщений из 5, страница 1 из 1
differentation using C++
    #33429120
dvo
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
dvo
Гость
I need urgent help in following problem. Please give me atleast and idea as how to implement it

thanks in advance for your time

I need to write a program that will differentiate expressions in the variable X. The input to this program will be a series, each representing an infix expression to be differentiated. Each such expressions is to be viewed as a stream of tokens. Valid tokens are integers, the variable X, the binary operators (+, -, *, /, ^), and parentheses. To make scanning for tokens easy, you may assume that each token is followed by exactly one space, with the exception of the final token, which is followed by the end of line character.

First the program will have to scan the infix expression, building up an appropriate binary tree representation of it. Once the binary expression tree is built, traverse it, building up an other binary expression tree, which represents the derivative of the original expression. The following differentiation rules should be used in this process:
Suppose C is a constant, and S and T are expressions in X:
Diff (C) = 0
Diff (X) = 1
Diff (S + T) = Diff (S) + Diff (T)
Diff (S - T) = Diff (S) - Diff (T)
Diff (S * T) = S * Diff (T) + T * Diff (S)
Diff (S / T) = ((T * Diff (S)) - (S * Diff (T))) / (T ^ 2)
Diff (S ^C) = (C * S ^ (C - 1)) * Diff (S)

Finally, once the binary expression tree for the derivative has been built, print the expression. Print it in completely parenthesized infix notation to avoid ambiguity.
Note that there are three distinct phases to this problem:
1) Parsing of the original infix expression into a binary tree representation
2) Building a binary tree representation of the derivative
3) Printing the derivative in completely parenthesized infix notation.
...
Рейтинг: 0 / 0
differentation using C++
    #33429135
Фотография Lelikk
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Translate expression into RPN.
It's stack form of expression:

"a + b * c" -> "b c * a +"
________________________________________________________
Глюк - это высокоорганизованная система не поддающихся определению частиц
...
Рейтинг: 0 / 0
differentation using C++
    #33429175
dvo
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
dvo
Гость
I have done that already. But what should i do next? Let's say i have the function in a binary tree, what to do next???
...
Рейтинг: 0 / 0
differentation using C++
    #33429176
dvo
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
dvo
Гость
I have done that already. But what should i do next? Let's say i have the function in a binary tree, what to do next???
...
Рейтинг: 0 / 0
differentation using C++
    #33429320
-me-
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Just of curiosity, while being student, I wrote something similar in Java.
Look at source code TNode.java in attached archive.

P.S. Афтар, пачиму пишишь ни паруззки? :)
...
Рейтинг: 0 / 0
5 сообщений из 5, страница 1 из 1
Форумы / Программирование [игнор отключен] [закрыт для гостей] / differentation using C++
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]