Help for OOP project

View previous topic View next topic Go down

Help for OOP project

Post by BIT0330-MOSHIUR on Mon Oct 17, 2011 3:28 am

আমার OOP course এর প্রজেক্ট এ আমি Integration করতে চাই । কিন্তু কিভাবে করব বুঝতে পারছি না।
সাহায্য চাই।

আমি চাই ব্যবহারকারী একটা ফাংশন ইনপুট দিবে এবং আমার project সেটাকে integration করে দেখাব।

BIT0330-MOSHIUR
Pre-Alpha Release
Pre-Alpha Release

Course(s) :
  • BIT

Blood Group : B+
Posts : 8
Points : 13

View user profile http://www.apprain.net/moshiur

Back to top Go down

Re: Help for OOP project

Post by BIT0122-Amit on Mon Oct 17, 2011 4:07 am

ভাইয়া, ফোরামে noticeboard টা ব্যবহার করা হয় শুধুমাত্র নোটিশ দিতে।

এধরণের অনুরোধের জন্য Programming and Brainstorm Chamber টাই একমাত্র যায়গা Smile

যাই হোক, তুমি যা করতে চাও সেটা নিয়ে কিছু প্রশ্ন করি।

১) প্রোগ্রামিং ভাষা কি হবে?
২) ফাংশন বলতে কি বুঝানো হচ্ছে?
৩) ফাংশন ইনপুট কিভাবে দেয়া হবে?
৪) ফাংশন টা ব্যবহারকারী ইনপুট দিলে এর পরে কি সেটা অন্য কোথাও ব্যবহৃত হবে না যেখানে ইনপুট দেয়া হলো সেখানেই ঢুকানোর সাথে সাথে কাজ করা শুরু করবে?

এতগুলা বোকা বোকা প্রশ্ন করলাম কারণ তোমার মাথায় ঢুকার সাধ্য খালি তোমারই আছে। আরেকটু বিস্তারিত দিলে সবার জন্য তোমার সাথে আলোচনা করা, বা তুমি কি ভেবে এসব বললে তা বুঝা অনেক সহজ হবে।

_________________________________________________________________
Adminship / Moderatorship is not about power, it is about Responsibility.

|About me|My Blog|
avatar
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

View user profile http://iitdu.forumsmotion.com

Back to top Go down

Re: Help for OOP project

Post by BIT0330-MOSHIUR on Mon Oct 17, 2011 4:58 am

১।JAVA
২।x,sinx,cosx,(cosx)^n,atanx etc.
৩।আমি GUI ব্যবহার করব।
৪।বুঝিনাই।

আমি চাচ্ছি ব্যবহারকারী একটা ফাংশন দিবে , আমার প্রগ্রাম সেটাকে নিয়ে কিছু কাজ করবে এবং ফাংশনটির Integration করে দেখাবে।
input: lnx,x^n
output: xlnx-x,(x^n+1)/n+1.
দুঃখিত এখানে পস্ট দেওয়ার জন্য।

BIT0330-MOSHIUR
Pre-Alpha Release
Pre-Alpha Release

Course(s) :
  • BIT

Blood Group : B+
Posts : 8
Points : 13

View user profile http://www.apprain.net/moshiur

Back to top Go down

Re: Help for OOP project

Post by BIT0122-Amit on Mon Oct 17, 2011 11:47 pm

ওহ আচ্ছা। আমি ভেবেছিলান Integration মানে component integration। সেক্ষেত্রে যেসব বুঝো নাই, সেগুলা বুঝার দরকার নাই।

তুমি যেটা করবে, সেটায় আসলে.. আমার মাথায় একগাদা if else ছাড়া কিচ্ছু আসছে না। মানে কিছু নির্দিষ্ট ধরণের ইনপুটের জন্য কিছু নির্দিষ্ট আউটপুট থাকবে। কম্পিউটার বেচারা তো আর বানায়ে কিছু করে না। :/

অবশ্য আমার মনে হয় অন্যরা আমার চাইতে বেশি ভালো ধারণা দিতে পারবে এই বিষয়ে। প্রোগ্রামারদের দৃষ্টি আকর্ষন করছি।

_________________________________________________________________
Adminship / Moderatorship is not about power, it is about Responsibility.

|About me|My Blog|
avatar
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

View user profile http://iitdu.forumsmotion.com

Back to top Go down

Re: Help for OOP project

Post by BIT0112-Rokon on Tue Oct 18, 2011 10:27 am

I would like to say that do some research on internet. There
are hundreds of resources available on Java Mathematics, Calculus, and whatever
you want. You will find thousands of java
applet and source code. Try those
applets and see how they works, read source code to know how they are written. Before replying this post, I googled on your
topic and found tons of information. It’s very important to know how to find
information from internet. So try.


And try to ask more specific question. And it’s better if
you do little research before asking question.
Try to write your question elaborately as much as possible. Don’t ask a vague question.

_________________________________________________________________


Code Explosion Blog | Code Explosion Wiki | The Rokonoid | নির্ঝরিণী
avatar
BIT0112-Rokon
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : O+
Posts : 673
Points : 1269

View user profile http://blog.codexplo.org

Back to top Go down

Re: Help for OOP project

Post by BIT0130-Shakkhor on Tue Oct 18, 2011 2:13 pm

To be honest, this will be difficult. To do something like this, first you'll need a expression evaluator. That means, you'll have to be able to evaluate any complex mathematical expres​sion(for example, 4x+3sin40).

To write an expression evaluator, you'll need to learn the following things:
1. Lexical Analyzer
2. Shunting-Yard Algorithm
3. Evaluating a postfix expression

Once you have your expression evaluator, you'll have to use a numerical method to find the integration.

For 1-D integrals, i recommend using Adaptive Quadrature. For M-D, use either Monte Carlo or quasi-Monte Carlo method or any of it's variants.

Once again, doing this won't be easy. You'll have to give it a lot of time and energy. Let me know if you need any more help.

_________________________________________________________________
I'm not a driver with drinking problem.
I'm an alcoholic with driving problem.

Blog | বাংলা ব্লগ
avatar
BIT0130-Shakkhor
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : B+
Posts : 209
Points : 328

View user profile

Back to top Go down

Re: Help for OOP project

Post by BIT0102-Mohaimin on Wed Oct 19, 2011 12:05 am

Integration is simply a summation.

Suppose your function is:
Code:
f(x) = 2x
And you need to integrate from -1 to 1

Do it in following steps:
1. Take a very small value d (say .01) and sum = 0
2. Loop a double value p from -1 to 1, increment by d
3. add f(p) with sum in every loop.

This way is seriously time inefficient. But its possibly the simplest solution that will work for ALL functions.

Here is a sample code:
Code:

    double integrate(double low, double up){
        double sum = 0, d = .01;
       
        for (double p = low; p <= up; p =d) {
            sum  = (f(p)*d);
        }
       
        return sum;
    }
   
    double f(double x){
        return 2*x;
    }
   
    double f(double x){
        return 2*x;
    }


There are some efficient algorithms to integrate in the Numarical Analysis book. Ask a second year guy for the book.
Check this google result


Last edited by BIT0102-Mohaimin on Fri Mar 23, 2012 1:29 pm; edited 2 times in total (Reason for editing : Mistake fixed in the code.)
avatar
BIT0102-Mohaimin
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : B+
Posts : 415
Points : 715

View user profile

Back to top Go down

Re: Help for OOP project

Post by BIT0102-Mohaimin on Wed Oct 19, 2011 12:15 am

You can use ScriptEngine to evaluate simple expressions. Here is an example:

Code:
        ScriptEngine engine = new ScriptEngineManager().getEngineByExtension("js");
        try {
            double value = (Double) engine.eval("4 3*4");
            System.out.println(value);
        } catch (Exception e) {           
            e.printStackTrace();
        }

ScriptEngine classes are found in javax.script package.

Always read the javadoc to learn about the classes.

avatar
BIT0102-Mohaimin
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : B+
Posts : 415
Points : 715

View user profile

Back to top Go down

Re: Help for OOP project

Post by BIT0330-MOSHIUR on Wed Oct 19, 2011 3:36 am

All the vias thanks a lot. I am working with your suggestions and my ideas. And i will try my best.

BIT0330-MOSHIUR
Pre-Alpha Release
Pre-Alpha Release

Course(s) :
  • BIT

Blood Group : B+
Posts : 8
Points : 13

View user profile http://www.apprain.net/moshiur

Back to top Go down

Re: Help for OOP project

Post by BIT0112-Rokon on Wed Oct 19, 2011 4:49 am

Mohaimin,


I don’t think it’s a good idea to use ScriptEngine right
now. Let him to write his own parser. May be it will be buggy, something worse,
but he will learn by that way.

_________________________________________________________________


Code Explosion Blog | Code Explosion Wiki | The Rokonoid | নির্ঝরিণী
avatar
BIT0112-Rokon
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : O+
Posts : 673
Points : 1269

View user profile http://blog.codexplo.org

Back to top Go down

Re: Help for OOP project

Post by BIT0122-Amit on Wed Oct 19, 2011 4:51 am

Problem is, he(Moshiur) mentioned function integration, and examples included symbols, not values.

Maybe Moshiur should clarify this part.

_________________________________________________________________
Adminship / Moderatorship is not about power, it is about Responsibility.

|About me|My Blog|
avatar
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

View user profile http://iitdu.forumsmotion.com

Back to top Go down

Re: Help for OOP project

Post by BIT0102-Mohaimin on Wed Oct 19, 2011 12:43 pm

There was a big mistake in my code. I have corrected it.

From
Code:
sum  = f(p);
to
Code:
sum  = (f(p)*d);
avatar
BIT0102-Mohaimin
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : B+
Posts : 415
Points : 715

View user profile

Back to top Go down

Re: Help for OOP project

Post by BIT0330-MOSHIUR on Thu Oct 20, 2011 12:16 am

I think (To Amit vaia) if i can find indefinite integration of a function then i can easily evaluate this function in any range.

BIT0330-MOSHIUR
Pre-Alpha Release
Pre-Alpha Release

Course(s) :
  • BIT

Blood Group : B+
Posts : 8
Points : 13

View user profile http://www.apprain.net/moshiur

Back to top Go down

Re: Help for OOP project

Post by BIT0122-Amit on Thu Oct 20, 2011 1:23 am

BIT0330-MOSHIUR wrote:I think (To Amit vaia) if i can find indefinite integration of a function then i can easily evaluate this function in any range.

In software engineering, specified requirement is everything.
If you only wanted indefinite integration, the approach can be of one type.
If you wanted evaluation, the approach will be different.
If you want both, the approach will be even more different.

And none of the approaches are of same difficulty level, nor do they need same level of work.

So, when you ask something, specify it clearly Smile

_________________________________________________________________
Adminship / Moderatorship is not about power, it is about Responsibility.

|About me|My Blog|
avatar
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

View user profile http://iitdu.forumsmotion.com

Back to top Go down

Re: Help for OOP project

Post by BIT0130-Shakkhor on Thu Oct 20, 2011 1:43 am

Congratulations, kid. You've just reached the boundary where humans and computers are separated. lol! Computers can't find indefinite integrals, that's something only humans can do. Indefinite integrals have an unlimited number of solutions. Only a human can decide which one is the simplest. Sure, you can plug rule after rule, and more rules after that to find some sort of simple form, but that chances are very slim.

See, the difference between humans and computers is, humans can solve problems. But computers, can only execute your solutions.

I suggest you take Mohaimin's advice and use the simple summation technique to find definite integrals. Adaptive Quadrature isn't very hard either (5-6 lines algorithm). You'll be needing a custom expression evaluator though, ScriptEngine probably won't work.

_________________________________________________________________
I'm not a driver with drinking problem.
I'm an alcoholic with driving problem.

Blog | বাংলা ব্লগ
avatar
BIT0130-Shakkhor
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : B+
Posts : 209
Points : 328

View user profile

Back to top Go down

Re: Help for OOP project

Post by BIT0122-Amit on Thu Oct 20, 2011 1:47 am

BIT0130-Shakkhor wrote:Congratulations, kid. You've just reached the boundary where humans and computers are separated. lol! You can't find indefinite integrals, that's something only humans can do. Indefinite integrals have an unlimited number of solutions. Only a human can decide which one is the simplest. Sure, you can plug rule after rule, and more rules after that to find some sort of simple form, but that chances are very slim.

See, the difference between humans and computers is, humans can solve problems. But computers, can only execute your solutions.


That's why I said I can only think about a lot of if-else when I thought he wanted only indefinite integrals.

Like++ for explaining it in a lot more easier way.

_________________________________________________________________
Adminship / Moderatorship is not about power, it is about Responsibility.

|About me|My Blog|
avatar
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

View user profile http://iitdu.forumsmotion.com

Back to top Go down

Re: Help for OOP project

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum