Jump to content



Photo
- - - - -

Lagrange


  • Please log in to reply
22 replies to this topic

#1 uterrorista

uterrorista

    Newbie

  • Members
  • Pip
  • 22 posts
  • Location:Portugal

  • Calculators:
    Casio ClassPad 300

Posted 13 June 2007 - 11:32 AM

Is there any program/add in that could make Lagrange interpolation.?

Thanks

#2 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 13 June 2007 - 10:19 PM

Is there any program/add in that could make Lagrange interpolation.?

Well, it isn't difficult to write a program for this (in CPLua, of course), but do you really need it? Lagrange interpolation is usually not the best choice. Do yourself a favor, use cubic splines instead. It's way more precise in most cases. I've included linear and cubic spline interpolations in LNA, but not Lagrange (and I'm not planning to add it).

#3 Behnoud

Behnoud

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 338 posts
  • Gender:Male
  • Location:Iran

  • Calculators:
    CP 300+ OS2.2/
    FX 3600 pv/
    FX 115 s/
    FX 602P

Posted 14 June 2007 - 07:28 AM

Can you release english edition,please?!

#4 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 15 June 2007 - 03:38 PM

Can you release english edition,please?!

English edition of what? If you mean a version of Lagrange interpolation, my answer is no. It can be easily done in CPLua, but, as I have explained before, Lagrange interpolation is superseded by Cubic Spline interpolation. I 'm not planning to add poor algorithms in LNA, and Lagrange interpolation is a poor algorithm, useful only for pedagogical purposes. In general, introductory algorithms will never included in LNA.

#5 uterrorista

uterrorista

    Newbie

  • Members
  • Pip
  • 22 posts
  • Location:Portugal

  • Calculators:
    Casio ClassPad 300

Posted 05 July 2007 - 02:54 PM

thank you all.

i want to aplly an interpolation to, example:

2 line matrix:

x: | 1433| 2750| 3683| 4200| 4516|
y: | 5000|10000|15000|20000|28000|


i want to know y, when x=3940..


something like this...

i still can?t do this.. Can someone show me how? Thanks.

#6 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 05 July 2007 - 06:22 PM

thank you all.
i want to aplly an interpolation to, example:
2 line matrix:

x: | 1433| 2750| 3683| 4200| 4516|
y: | 5000|10000|15000|20000|28000|

i want to know y, when x=3940..

something like this...
i still can?t do this.. Can someone show me how? Thanks.

Use LNA to do cubic spline interpolation. For example, the following CPLua code will return y for a user-defined x:
require("LNA/CSpline")
local xdata,ydata,scoeff,x
xdata={1433,2750,3683,4200,4516}
ydata={5000,10000,15000,20000,28000}
scoeff=CreateSpline(xdata,ydata)
x=input("Give x:")
print(CubicSpline(x,0,xdata,scoeff))
You can also calculate interpolating 1st and 2nd order derivatives if you want. See LNA manual, especially pages 48-52 :r-t-f-m:

P.S.: Why do I spend hours ans hours to write LNA's documentation, since none wants to read it? :banghead:

#7 uterrorista

uterrorista

    Newbie

  • Members
  • Pip
  • 22 posts
  • Location:Portugal

  • Calculators:
    Casio ClassPad 300

Posted 06 July 2007 - 12:44 PM

i don't understant that much of LNA.
but i'll try..

I already write that code, but i need LNA/CSpline.. Where can i get it?

LNA's documentation?
Do you refer do the PDF version that is in this page???

#8 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 06 July 2007 - 02:30 PM

i don't understant that much of LNA.
but i'll try..
I already write that code, but i need LNA/CSpline.. Where can i get it?
LNA's documentation?
Do you refer do the PDF version that is in this page???

Hmmm, you are totally confused here. CSpline is part of LNA, a project I'm developing for ClassPad, so you need to install LNA. LNA, in turn, needs a programming language called CPLua to run, so you need CPLua as well (you really don't know anything about CPLua? you use CPBasic so far? :blink:)

So, if you want to use the program I have posted, you have to:
(1) Install CPLua. Here is the link, but you really need to read stuff about CPLua itself first.
(2) Install (in fact, transfer) LNA. Here is LNA's topic in the File Sharing, where you will find links to download LNA and its documentation. You will certainly need to read the documentation, at least parts of it. :r-t-f-m:
(3) Write the program I have posted in CPLua's editor and run it.

P.S.: If you expect you will be able to use LNA's capabilities without reading anything, you will be highly disappointed. :greengrin:

#9 uterrorista

uterrorista

    Newbie

  • Members
  • Pip
  • 22 posts
  • Location:Portugal

  • Calculators:
    Casio ClassPad 300

Posted 06 July 2007 - 04:58 PM

-you are totally confused here??
You bet..

-CPBasic so far?
Yes.. when i need something more, I'm too busy(studying) and i haven't time to learn...

This evening i'll take a look.. THANK YOU..

#10 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 07 July 2007 - 08:11 AM

-CPBasic so far?
Yes.. when i need something more, I'm too busy(studying) and i haven't time to learn...

Do yourself a favour: whenever you have some free time to spend, run, do not walk, to the CPLua project topic, and forget CPBasic once and for all.

#11 uterrorista

uterrorista

    Newbie

  • Members
  • Pip
  • 22 posts
  • Location:Portugal

  • Calculators:
    Casio ClassPad 300

Posted 09 July 2007 - 09:56 AM

the program is not working:

runtime Error:
LNA/CSpline:115: attempt to compare string with number




i edited the program to:

require("LNA/CSpline")
local xdata,ydata,scoeff,x
xdata={1433,2750,3683,4200,4516}
ydata={5000,10000,15000,20000,28000}
scoeff=CreateSpline(xdata,ydata)
x=3940
print(CubicSpline(x,0,xdata,scoeff))

now it works..

#12 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 09 July 2007 - 01:44 PM

Indeed, input() returns a string, it must be converted to a number first :)
The correct line should be
x=tonumber(input("Give x:"))
;)

#13 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 09 July 2007 - 04:40 PM

As you can easily guess, I wrote the program directly in my post, I didn't tried it in ClassPad, because it was very simple. As it always happens with simple things, I forgot something: input() returns a string. I apologize for that error :huh:.

#14 uterrorista

uterrorista

    Newbie

  • Members
  • Pip
  • 22 posts
  • Location:Portugal

  • Calculators:
    Casio ClassPad 300

Posted 09 July 2007 - 07:24 PM

;) No problem.

the only programmation language i know is C... the 'mother' of all languages i think.
where can i learn a bit more of this CPLua language??

#15 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 10 July 2007 - 09:45 AM

the only programmation language i know is C... the 'mother' of all languages i think.

Totally incorrect. The first high-level programming language was Fortran, introduced in 1956, decades before C. Since then, Fortran has been upgraded several times, and today is a full module-oriented programming language, ideal for mathematical programming (where C/C++ s*cks hard).

where can i learn a bit more of this CPLua language??

Start here, and please search casiocalc a little bit, before asking something already answered.

#16 uterrorista

uterrorista

    Newbie

  • Members
  • Pip
  • 22 posts
  • Location:Portugal

  • Calculators:
    Casio ClassPad 300

Posted 10 July 2007 - 10:51 AM

Totally incorrect. The first high-level programming language was Fortran, introduced in 1956, decades before C. Since then, Fortran has been upgraded several times, and today is a full module-oriented programming language, ideal for mathematical programming (where C/C++ s*cks hard).

Start here, and please search casiocalc a little bit, before asking something already answered.


Perhaps i exagereated when i said 'the mother of all languages'..
But C is a very inportant language .This language influenced: awk, csh, C++, C#, Objective-C, BitC, D, Concurrent C, Java, JavaScript, Limbo, Perl,PHP..

I've already saw that PDF guide. i only asked beacause you know the language and i wanted the best guide...

Thanks

#17 Orwell

Orwell

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 777 posts
  • Gender:Male
  • Location:Paris - France

  • Calculators:
    Casio AFX 1.02 / Casio ClassPad 300

Posted 10 July 2007 - 03:07 PM

Nonono, never try to discuss about C and Fortran :lol2:

(Fortunately for you, the Lua language is closer from C than Fortran, so don't worry :D)

#18 The_AFX_Master

The_AFX_Master

    Casio Overlord

  • Admin
  • PipPipPipPipPipPipPip
  • 519 posts
  • Gender:Male
  • Location:Black Mesa Research Facility (sector C)
  • Interests:BASIC +FORTRAN 90+ C++.....and HALF LIFE

  • Calculators:
    Casio Algebra FX 2.0 Plus, Casio fx 570 ms, Classpad 300, And a crowbar

Posted 12 July 2007 - 01:11 AM

Engrish is the best of the programming languages


#include all_your_base_are_belong_to_us.h

#19 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 12 July 2007 - 04:44 PM

Engrish is the best of the programming languages
#include all_your_base_are_belong_to_us.h

"Engrish"? :blink:. If you mean "English", I strongly disagree. English is a rather poor language, compared to my native language, or German, or French <_<.
Anyway, there is no "best programming language". You want to write a mathematical program? Fortran. An applet game? Java. An operating system? C++. A graphical user interface? all of the above languages will do, and even more.

#20 The_AFX_Master

The_AFX_Master

    Casio Overlord

  • Admin
  • PipPipPipPipPipPipPip
  • 519 posts
  • Gender:Male
  • Location:Black Mesa Research Facility (sector C)
  • Interests:BASIC +FORTRAN 90+ C++.....and HALF LIFE

  • Calculators:
    Casio Algebra FX 2.0 Plus, Casio fx 570 ms, Classpad 300, And a crowbar

Posted 13 July 2007 - 01:17 AM

Dude!.. Engrish!.. WITH R.. see Engrish on Wikipedia. For sure you don't remember the ALL YOUR BASE ARE BELONG TO US joke :D

#21 PAP

PAP

    Casio Overlord

  • Members
  • PipPipPipPipPipPipPip
  • 681 posts
  • Gender:Male
  • Location:Somewhere in Europe.
  • Interests:Computer Algebra, Numerical Analysis.

  • Calculators:
    ClassPad 300 (plus an old Casio model, with only a few Kb ram).

Posted 13 July 2007 - 12:55 PM

Dude!.. Engrish!.. WITH R.. see Engrish on Wikipedia. For sure you don't remember the ALL YOUR BASE ARE BELONG TO US joke :D

Ok, I admit it (but don't tell it to anyone): I knew nothing about "Engrish" and the "All our base are belong to us" joke :secret:. Funny and horrible translation, even my English is better than this :lol2:.

ALL YOUR ClassPad ARE BELONG TO ME :crimson:
:plol:

#22 Guest_Guest_akdov_*_*

Guest_Guest_akdov_*_*
  • Guests

Posted 09 March 2010 - 09:49 AM

i need help in translating C++ programs into casio ones:

im working on lagrange interpolation right now,

if i start with this loop (from C++)

for (i=0; i<=n; i++)
{
cin >> x[i] >> y[i];
}

translating it to casio,
for 0->I to N step 1
"X[I]" ? -> // going to wat ? how can i put an index in casio ?
"Y[I]" ? -> //same question
Next

#23 ASTRO491K

ASTRO491K

    Casio Addict

  • Members
  • PipPipPip
  • 94 posts

Posted 09 March 2010 - 09:13 PM

I really enjoyed reading the exchange you guys have had, so let me ask you both, what do you think of the TI-nspire programing (and restrictions). (Please don't throw things at me, I just want to find out if your evaluation is similiar to mine.)

i need help in translating C++ programs into casio ones:

im working on lagrange interpolation right now,

if i start with this loop (from C++)

for (i=0; i<=n; i++)
{
cin >> x[i] >> y[i];
}

translating it to casio,
for 0->I to N step 1
"X[I]" ? -> // going to wat ? how can i put an index in casio ?
"Y[I]" ? -> //same question
Next






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users