I need to do a program that meets infinite limits please

please help me I need a c ++ program that solves problems about infinite limits with their respective graph.
If you would help me, I would be very grateful for my final project of integral calculation.
I tried it in different ways but I did not leave the program
Do you realize just how ambiguous and vague your post is?

It sounds like you've already tried something, but it isn't working right. Why not show us specifically what you've tried, and what you're trying to accomplish?

I assume you mean numerical calculations for limits and integrals, and not symbolic. Because symbolic would be a whole lot harder.

A simple way of numerically calculating a limit could be something like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Example program
#include <iostream>
#include <cmath>

typedef double (*Function)(double);

double limit(Function function, double x, double epsilon)
{
    return (function(x - epsilon) + function(x + epsilon)) / 2.0;
}

double sinc(double x)
{
    return std::sin(x) / x;
}

int main()
{
    std::cout << "sin(0)/0 = " << sinc(0) << '\n';
    std::cout << "Limit of sin(x)/x as x approaches 0 = " << limit(sinc, 0, 0.0001) << '\n';
}

sin(0)/0 = -nan
Limit of sin(x)/x as x approaches 0 = 1


Of course, this isn't very robust. Won't work for cases where the limit doesn't exist (e.g. 1/x as x approaches 0). You would want an extra test on top of this one to check if the LHS limit roughly matches the RHS limit.
Last edited on
Thank you friend @ for your contribution to my project, I would have shown my code if I only needed something small to modify, but the reality is that I have a bad majority since I still don't have much knowledge, but as you can see they sent me this type of task.
Last edited on
josuex wrote:
as you can see

No, @josuex, we can't see anything. Because you have posted no code and no statement of your problem.

If you would like assistance you are really going to have to be clearer.
Topic archived. No new replies allowed.