π
<-

if function in graph

:32tins: :32tinsktpb: :32tinsktpn: :32tinscas: :32tinstpkc: :32tinstpktpb: :32tinstp: :32tinscastp: :32tinscmc: :32tinscx: :32tinscxcas:

if function in graph

Unread postby sportler1993 » 15 Dec 2012, 09:32

Hello
I search a programm witch can split a graph in 3spaces
Perhaps If X<=2 Y=2X
If 10<X>2 Y=5x
If X>=10 Y=50

Is there any possibility to make this :help:
User avatar
sportler1993
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Level up: 56%
 
Posts: 13
Joined: 19 Sep 2012, 17:18
Location: Switzerland
Gender: Male
Calculator(s):
MyCalcs profile

Re: if function in graph

Unread postby Levak » 15 Dec 2012, 09:49

Hi,
You can directly do it in a function on TI-Nspire :
Code: Select all
: Define myfunc(x) = Func
:   If x <= 2
:     Return 2*x
:   If x > 2 and x < 10
:     Return 5*x
:   Return 50
: EndFunc


and draw the function f1(x) = myfunc(x) in a Graph page.
Responsable design/graphique de TI-Planet
I do not get mad at people, I just want them to learn the way I learnt.
ImageTNOC [topic][DL]
nClock [topic][DL]
HideManager [topic][DL]
ZLock [topic][DL]
Theme Editor [topic][DL]
Mes programmes
User avatar
LevakAdmin
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 98.9%
 
Posts: 6414
Images: 22
Joined: 27 Nov 2008, 00:00
Location: 0x1AACC355
Gender: Male
Calculator(s):
MyCalcs profile
Class: BAC+5: Epita (ING3)

Re: if function in graph

Unread postby sportler1993 » 15 Dec 2012, 16:39

Thanks
But i dont know where i should enter this code?
Thanks for help
User avatar
sportler1993
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Level up: 56%
 
Posts: 13
Joined: 19 Sep 2012, 17:18
Location: Switzerland
Gender: Male
Calculator(s):
MyCalcs profile

Re: if function in graph

Unread postby Bisam » 15 Dec 2012, 16:42

You can also use the function "when" or better, the "piecewise template", that is the left bracket { with 4 spaces 2 by 2 separated by commas.

The syntax for the piecewise template is :
Code: Select all
{ 2x , x<=2
{ 5x , x>2 and x<10
{ 50 , x>=10

where the left brackets should be only one bracket on you calc.

The one for "when" is :
Code: Select all
when(x<=2, 2x, when(x<10, 5x,50))



If you use Levak's method, you should create a "function" using the editor on calc.
User avatar
BisamAdmin
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Level up: 69.6%
 
Posts: 5670
Joined: 11 Mar 2008, 00:00
Location: Lyon
Gender: Male
Calculator(s):
MyCalcs profile

if function in graph

Unread postby sportler1993 » 21 Jan 2013, 21:47

Whiy this code dont work?
How can i define a?

Code: Select all
: Define myfunc(x) = Func
:   a=2x
:   If a <= 2
:     Return 2*x
:   If a > 2 and a < 10
:     Return 5*x
:   Return 50
: EndFunc
User avatar
sportler1993
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Level up: 56%
 
Posts: 13
Joined: 19 Sep 2012, 17:18
Location: Switzerland
Gender: Male
Calculator(s):
MyCalcs profile

Re: if function in graph

Unread postby Excale » 21 Jan 2013, 22:03

a:=2x and Endif :).
User avatar
ExcaleAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 3.9%
 
Posts: 2955
Images: 3
Joined: 10 Sep 2010, 00:00
Gender: Male
Calculator(s):
MyCalcs profile

Re: if function in graph

Unread postby Levak » 22 Jan 2013, 03:04

Hi
You also should use "Local a" at the beginning of the functiin since in a Func (contrary to a Prgm) you cannot modify the external variables.
Responsable design/graphique de TI-Planet
I do not get mad at people, I just want them to learn the way I learnt.
ImageTNOC [topic][DL]
nClock [topic][DL]
HideManager [topic][DL]
ZLock [topic][DL]
Theme Editor [topic][DL]
Mes programmes
User avatar
LevakAdmin
Niveau 14: CI (Calculateur de l'Infini)
Niveau 14: CI (Calculateur de l'Infini)
Level up: 98.9%
 
Posts: 6414
Images: 22
Joined: 27 Nov 2008, 00:00
Location: 0x1AACC355
Gender: Male
Calculator(s):
MyCalcs profile
Class: BAC+5: Epita (ING3)

Re: if function in graph

Unread postby Bisam » 22 Jan 2013, 09:43

The "Endif" is not necessary : there is no "Then".
Is is useless when there is only one instruction after "If".

As for the "Local", you HAVE TO use it in a function.
User avatar
BisamAdmin
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Level up: 69.6%
 
Posts: 5670
Joined: 11 Mar 2008, 00:00
Location: Lyon
Gender: Male
Calculator(s):
MyCalcs profile


Return to Problèmes divers / Aide débutants

Who is online

Users browsing this forum: ClaudeBot [spider] and 22 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
1234
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1696 utilisateurs:
>1668 invités
>21 membres
>7 robots
Record simultané (sur 6 mois):
29271 utilisateurs (le 11/07/2025)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)