How to Write a C Program for Derivative Calculation?

AI Thread Summary
The discussion revolves around writing a C program that reads a mathematical expression from standard input, computes its derivative, and outputs the result. The user has successfully converted the expression to postfix form using the Shunting Yard algorithm but is struggling to proceed with the differentiation process. Participants in the discussion emphasize the need for clarity regarding the types of functions to be included and the specific requirements for parsing the expression. They point out that the input expression contains functions like "tan" and "ln" that need to be treated as functions rather than numbers. The conversation highlights the importance of defining the scope of the program and the complexity involved in implementing the differentiation logic.
rambo3131
Messages
18
Reaction score
0
Hi,i ve problem about C.i should write a program that read expression from standart input take derivative and print.
For example: input: (X^2-1)*tan-ln^2/X
output: (((X*2)*tan+(tan^2+1)*(X^2-1))-(1/X*ln*2*X-ln^2)/X^2)

I converted expression to postfix form by shuting yard algorithm ,but then i couldn't continue..please help me ...This is so important..
 
Technology news on Phys.org
rambo3131 said:
Hi,i ve problem about C.i should write a program that read expression from standart input take derivative and print.
For example: input: (X^2-1)*tan-ln^2/X
output: (((X*2)*tan+(tan^2+1)*(X^2-1))-(1/X*ln*2*X-ln^2)/X^2)

I converted expression to postfix form by shuting yard algorithm ,but then i couldn't continue..please help me ...This is so important..

Please show us what you have so far.
 
rambo3131 said:
Hi,i ve problem about C.i should write a program that read expression from standart input take derivative and print.
For example: input: (X^2-1)*tan-ln^2/X
output: (((X*2)*tan+(tan^2+1)*(X^2-1))-(1/X*ln*2*X-ln^2)/X^2)
Your input expression is meaningless. tan and ln are not numbers, as you seem to show in the output expression. These are functions, each of which takes an argument.


rambo3131 said:
I converted expression to postfix form by shuting yard algorithm ,but then i couldn't continue..please help me ...This is so important..
 
rambo3131 said:
Hi,i ve problem about C.i should write a program that read expression from standart input take derivative and print.
For example: input: (X^2-1)*tan-ln^2/X
output: (((X*2)*tan+(tan^2+1)*(X^2-1))-(1/X*ln*2*X-ln^2)/X^2)

I converted expression to postfix form by shuting yard algorithm ,but then i couldn't continue..please help me ...This is so important..

How general do you want to go? How many types of functions do you want to use?

The first thing you should do is answer the above, and then think about you are going to parse the expression to get tokens that are atomic and that you can work with.

Depending on what restrictions you want, the implementation could be very complicated.

So I guess my question is, what exactly do you want to do? What possible expressions can you have? Your explanation is not specific enough to give you any pointers.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
15
Views
4K
Replies
18
Views
3K
Replies
10
Views
913
Replies
4
Views
1K
Replies
29
Views
3K
Replies
25
Views
2K
Replies
5
Views
3K
Back
Top