too many arguments

1,522 views
Skip to first unread message

Jean Pierre Daviau

unread,
Mar 28, 2011, 9:33:37 AM3/28/11
to tins...@googlegroups.com
Hi,
 
I am trying my first program and I have got a too many arguments prompt.
 
eul(1,1,0.4)
---
Define LibPub eul(x,y,h)=
Func
:Local a=5
:Local q
:While a−− >0
:q=y + h*(y)
:eul((x+1),q,h) 
:EndWhile
:EndFunc
-----------
 
Thanks for your attention,
 
JP

Bikash Jain

unread,
Mar 28, 2011, 9:52:57 AM3/28/11
to tins...@googlegroups.com
Are you sure you're putting a decimal in third argument like eul(1,1,0.4) and not like eul(1,1,0,4).

As suggested by error too many argument pops up when number of argument is more then you defined.


Regards-

Bikash Jain


-original message-
Subject: [tinspire] too many arguments
From: Jean Pierre Daviau <davi...@videotron.ca>
Date: 28/03/2011 7:04 PM

Hi,

I am trying my first program and I have got a too many arguments prompt.

eul(1,1,0.4)
---
Define LibPub eul(x,y,h)=
Func
:Local a=5
:Local q

:While a-- >0


:q=y + h*(y)
:eul((x+1),q,h)
:EndWhile
:EndFunc
-----------

Thanks for your attention,

JP

--
To post to this group, send email to tins...@googlegroups.com
To unsubscribe send email to tinspire+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com.au/group/tinspire?hl=en-GB?hl=en-GB
The tns documents shared by group members are archived at
http://lafacroft.com/archive/nspire.php

Nelson Sousa

unread,
Mar 28, 2011, 9:54:29 AM3/28/11
to tins...@googlegroups.com
Errrr... I reccommend you take a look at the reference manual before
starting to program on the Nspire. You have a lot of syntax errors
that are simple translations from other languages.

Local a=5
This line doesn't make sense, you can't define and assign in the same
command. Plus, assignment isn't done by =, = is the comparison.

While a-- >0
There's no ++ or -- notion on the Nspire; plus, you can't make
assignments on the while conditions.

q=u+h*(y)
Besides assignment isn't performed like this, h*(y) in Nspire notation
is the same as h*y, the multiplication of two numbers.

Basic rules:

Local var1, var2, ...
Defines var1, var2, ... as local variables.

Assignment:
a:=1
b:=2x
f(x):=sin(x)

While Loops
while( a>-1)
doStuff()
a:=a-1
endwhile

For loop
n:=1
for i,1,10,1
n:=n*i
endfor
return n

You can't just copy&paste code from other languages and expect it to work.

Cheers,
Nelson

On Mon, Mar 28, 2011 at 14:33, Jean Pierre Daviau <davi...@videotron.ca> wrote:
> Hi,
>
> I am trying my first program and I have got a too many arguments prompt.
>
> eul(1,1,0.4)
> ---
> Define LibPub eul(x,y,h)=
> Func
> :Local a=5
> :Local q

> :While a-- >0


> :q=y + h*(y)
> :eul((x+1),q,h)
> :EndWhile
> :EndFunc
> -----------
>
> Thanks for your attention,
>
> JP
>

Andy Kemp

unread,
Mar 28, 2011, 9:55:25 AM3/28/11
to tins...@googlegroups.com
Not quite sure how you think this will work as you have your while command based on the value of a but a is set to be a constant value of 5...

--

Sean Bird

unread,
Mar 28, 2011, 10:26:44 AM3/28/11
to tins...@googlegroups.com
Here is an example of an Euler program from Bryson's website
Define LibPub eulert(x,y,h,n)=
Prgm
:© Before running the program: Define d(x,y) = ((dy)/(dx)).
:Local i
:i:=0
:While i≤n
:Disp "Point #",i
:Disp "x = ",x
:Disp "y = ",y
:Disp " "
:y:=y+h*d(x,y)
:x:=x+h
:i:=i+1
:Cycle
:EndWhile
:EndPrgm


If you want to use the Request feature and not require syntax to be remembered by the user at the beginning, here is a little program I put together that can be put into the MyLib.
Define LibPub eulerm()=
Prgm
:© eulerm() Euler Method-pronounced Oiler
:Define d(x,y)=x*y
:Request "differential equation, dy/dx=",d(x,y)
:Request "initial condition, x₀=",xo,0
:Request "initial condition, y₀=",yo,0
:Request "step size, Δx=",h,0
:Request "number of iterations?",n,0
:Text "Using the differential equation dy/dx first apply the initial condition ("&string(xo)&","&string(yo)&") to find the slope. Slope, m = "&string(d(xo,yo))&"  Then multiply dy/dx by Δx to get the change in y. To get the next point, add Δx to x₀ and your Δy to y₀. The next point is ("&string(xo+h)&","&string(yo+d(xo,yo)*h)&"). Repeat this process."
:Local i
:i:=0
:While i≤n
:Disp "Point #"&string(i)&")    x"&string(i)&" = "&string(xo)&"   y"&string(i)&" = "&string(yo)&"    "
:yo:=yo+h*d(xo,yo)
:xo:=xo+h
:i:=i+1
:Cycle
:EndWhile
:EndPrgm

--
To post to this group, send email to tins...@googlegroups.com
To unsubscribe send email to tinspire+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com.au/group/tinspire?hl=en-GB?hl=en-GB
The tns documents shared by group members are archived at
http://lafacroft.com/archive/nspire.php



--
Sean Bird
AP Calculus & Physics,
NHS Adviser & Rocket Team Supervisor
Math & Science Technology Coordinator
Covenant Christian High School
7525 West 21st Street
Indianapolis, IN 46214
Phone: 317/390.0202 x104 Fax: 317/390.6823
Website: http://covenantchristian.org/bird
work Email: sean...@covenantchristian.org
personal Email: covena...@gmail.com
Psalm 111:2 “Great are the works of the LORD, studied by all who delight in them.”
Reply all
Reply to author
Forward
0 new messages