Jump to content



Photo
- - - - -

How create a handle function in a program on CG20?

fx-CG20 CG20 prizm CG10 CG50 CG

Best Answer mar_n , 29 October 2024 - 09:38 PM

To close this up.

I've found out that you can use either function memory (fn_X_) or graphical function memory (Y_X_).

Go to the full post


  • Please log in to reply
3 replies to this topic

#1 mar_n

mar_n

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    fx-CG 20
    fx-4500p

Posted 28 October 2024 - 02:57 PM

The question is simple really, as I state in the headline. I've gotten to a point in life where I need to create programs to save time during preparation and exams.

 

What I am trying to achieve now is -

Model situation:
You have a function like f(x) given to you, it is a nonlinear function and you need to find it's approximate solution, you'll do so trough regula-falsi or bisection method.

 

I want to make me a programme that iterates trough said solutions and gives me the required output.

 

Now to the core of my question, how can prompt the user to input said function f(x), in order to be used during the program runtime for calculations?
I don't really know how or in what to store the function.
To clarify, I mean something like a handle function in matlab:
 

f = @(x,y) (x.^2 - y.^2)
## where x, y are the input parameters

 



#2 pan.gejt

pan.gejt

    Casio Freak

  • Members
  • PipPipPipPip
  • 264 posts
  • Gender:Male
  • Location:CZ

  • Calculators:
    .

Posted 28 October 2024 - 06:07 PM

It is very simple, the procedure is the same as the storing values to variables

 

"F(x,y)"->Y1

 

"F(x,y)" - is the prompt to enter the function, in this case function of 2 variables x and y

-> is storing command

Y1 - this is the most important part, this command serves for storing the function, in this case to Y1 (the memory is from Y1 to Y20 as in the graph). This command is available in "vars" key: vars - graph (F4) - Y - number (1 - 20)



#3 mar_n

mar_n

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    fx-CG 20
    fx-4500p

Posted 28 October 2024 - 07:16 PM

Alright, thanks for you reply, I've already figured how to do so, and have implemented it into my code.

But now I've run into another problem:
I am getting a Syntax Error At the Last line of the following code:

 

ClrText
"START INTERVAL A="?->A
"END INTERVAL B="?->B
"PRECISION _#E644_="?->P
"FUNCTION _@E766_(X)"?->fn10
ClrText
ClrMat Z
{15,7}->Dim Mat Z
For 1->K To 11
K->Mat Z[K,1]
A->Mat Z[K,2]
B->Mat Z[K,3]
(A+B)frac2->C
C->Mat Z[K,4]
A->X
fn10->Mat Z[K,5]
B->X
fn10->Mat Z[K,6]
C->X
fn10->Mat Z[K,7]
If Mat Z[K,5]*Mat Z[K,7]<0
Then C->B
Else C->A
IfEnd
If K>=2
Then "K_>=_2"
If Abs (Mat Z[K,7]-Mat Z[K-1,7])<P
Then "END"
Mat ZDisps
IfEnd
Next

The code runs just fine until I add the If K_>=_2 condition to the end.
Could anyone please spot the problem?

 



#4 mar_n

mar_n

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    fx-CG 20
    fx-4500p

Posted 29 October 2024 - 09:38 PM   Best Answer

To close this up.

I've found out that you can use either function memory (fn_X_) or graphical function memory (Y_X_).





Also tagged with one or more of these keywords: fx-CG20, CG20, prizm, CG10, CG50, CG

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users