Jump to content



Photo
* * * * * 4 votes

C.Basic - International Release

Casio Basic C.Basic

  • Please log in to reply
526 replies to this topic

#441 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 122 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G, Casio fx-CG20

Posted 28 October 2019 - 09:41 AM

I have programmed something which may be of interest for some of you.

 

 

Benjamin Gombertz proposed a function which describes the mortality of humans in dependency of age:
 
µ =  α exp (β t),
 
where the time t is counted in years. The value µ is the probability of passing away with age t.
Normally, α = 0.000'1 and β=0.085 is used.
The formula is valid for adult, older around 30 years.
β=0.085 means that the mortality is doubled every 8.15 years
α = 0.000'1 means that the mortality is around 0.13% at age of 30.
 
I  cast the formula in a small program which follows the course of 10'000 (simulated) people. It calculates the life expectancy and the age where the mos die (which is different).
With 10'000 people it runs for some minutes. You may choose for the firste experiments N=1000 or even N=100.
You may play around with the numners and look how things change.
 
It may be of interest to look at the vector (technical a matrix) s which contains the number of people which die at every age.
 
The programs calculates µ from birth. Please keep in mind that this is incorrect. The formula is not valid for non adults. The mortality rate of children or babies is higher.
10000->N%
1Exp(-)4->a
0.085->b
{150,1}->Dim Mat s
For 1->j% To N%
 For 0->i% To 150
  ae^(bi%)->m
  If m>Ran#
   s[i%]+1->s[i%]
   {j%,i%}
   Break
  IfEnd
 Next
Next
0->s%'sum
0->S%'max.mortality
0->M%
For 0->i% To 149
 If s[i%]>S%
  s[i%]->S%
  i%->X%'maximum
 IfEnd
 s%+s[i%]->s%
 If s%>N%/2 And 0=M%
  i%->M%'median
 IfEnd 
 Next
"most die at"
X%Disps
"half are dead with"
M%Disps


#442 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 29 October 2019 - 05:20 AM

Thanks for the interesting program. :D
This is a useful program for using integer variables.
 
The index start value must be 0 to run the program,
'#Mat 0
Alternatively, it can specify 0 at the matrix allocation. :)
{150,1}-> Dim Mat a.0
or (When specifying the integer matrix)
{150,1}-> Dim Mat a.L0
 
And
When using the Disp command, the result display is displayed at once. ^_^
(Shift+VARS(PRGM)+F6+F2(DISPAY)-F6(Disp))
"most die at"
Disp X%
"half are dead with"
Disp M%
 
And more,
Speed up by binary arithmetic.(+40% faster) ^_^
  a*e^(b*i%)->m

 



#443 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 122 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G, Casio fx-CG20

Posted 29 October 2019 - 10:15 AM

I did non know the Disp command. This is what I always looked for!

 

I know I tend to use the multiplication without sign (as mathematicians do). But in this case, in the deepest inner of the central loop, it has a large effect.



#444 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 29 October 2019 - 11:12 AM

The Disp command came from TI-Basic. :D
This command is very useful for displaying general results.
It can take multiple arguments.
Disp "A=",A,"B=",B

 



#445 CalcLoverHK

CalcLoverHK

    Casio Freak

  • Members
  • PipPipPipPip
  • 187 posts
  • Gender:Male
  • Location:Hong Kong
  • Interests:Playing video games (especially Minecraft), calculators, programming (Casio Basic/C.Basic, Scratch), watching memes, IT research, mathematics...

  • Calculators:
    fx-50FHII
    fx-9860GII Emulator (expired)
    fx-CG50 Emulator (expired)

Posted 29 October 2019 - 11:30 AM

Hi sentaro21,

 

If running:

Disp "A=",1,"B=",2,"C=",3 

Does the output result looks like the following?

 

 

A=1

B=2

C=3

 

Cheers,

CalcLoverHK



#446 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 29 October 2019 - 12:26 PM

No, the result looks like this. :)

A=
                      1
B=
                      2
C=
                      3


#447 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 122 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G, Casio fx-CG20

Posted 01 November 2019 - 09:28 AM

Dear Sentaro,

 

it seems I found an error in your program. When you set the color of a plot comman, it seems that this color is set *afterwards*,that means after the plot.

 

I give you an example. Subroutine G makes nothing but to set the graphics parameters. The program should draw a black line at 0.2 and a blue line at 0.4. But the result is inverse.

 

 
Gosub G
For 0->i% To 600
 Black Plot i%/10,0.2
 Blue Plot i%/10,0.4
Next
Gosub S
Stop


Lbl G
ClrGraph:CoordOff:AxesOff:GridOff:LabelOff:S-L-Normal:Rad:'#_SketchThin _
AxesOn
' x0 x\1 dx y0 y\1 dy
ViewWindow 0,60,10,0,1,0.2
Return 
'Print._X_Y
Lbl P
Text 1,9,"                               "
Text 1,9,X
Text 1,179,Y
Return 
'Stop
Lbl S
Plot :Text 1,1,">"Disps
While Getkey<>31:WhileEnd'exit=47
Return 


#448 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 01 November 2019 - 11:03 AM

Please try this program in C.Basic and genuine Casio Basic.
ClrGraph:CoordOff:AxesOff:GridOff:LabelOff:S-L-Normal:Rad
AxesOn
ViewWindow 0,60,10,0,1,0.2
 
For 0->I To 60
Black Plot I,0.2
Blue Plot I,0.4
Next
Plot :Text 1,1,">"
The specification of the color of the Plot command seems to be the color of the next Plot. :)
 
In this program
I noticed that the last ">" color is not compatible.
Thanks! :D
 


#449 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 122 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G, Casio fx-CG20

Posted 03 November 2019 - 09:26 AM

Good morning,
 
a few days ago i gave a program here which calculates the mortality of humans. I needed this for a slightly more complicated program, which calculates how long a conspiration can be hold hidden. The first one who maked calculations about this was Robert Grimes:
 
 
 
May aim is the so called moon hoax: 
 
 
 
I took most of the numbers form his article. But I implemented a slightly different method. The main idea is that everybody who is inaugurated has a probability "p" to disclose such a conspiration, whether per mistake or per aim. The value given from Grimes was around 4e-6 per year and person. This is quite low.
 
I don't think that we can say something is detected more accurate than one week. For this reason, my programm calculates week by week. From the probability p I calculate the probability "f" that nobody of the whole community decovers something. From that, I calculate the value "g" which is the probability that the secret is secure for the time "t", and the inverse of it "l": the detection probability.
 
I store the values h and H. These are times, for which l gets lower than 95 and 50%, respectively.
 
The program makes a graph of the detection probability ofer the time. You may change the number of persons involved from input.
 
~
 
Grimes looked for ways to get an idea of the value "p". Here he used real conspiration which were detected. There are three of them in the article, The PRISM project, the Syphilis experiment and the FBI scandal. He investigated in the perosns involved, and calculated the most probable value of p for these events.
 
I wrote my own analysis programm too. It does not have and graphics in it, because it runs for a while even without it. My resuts are as close to Grimes' as meaningful [I don't believe in the two decimals of Grimes' values of p].
 
You may try it for yourself
 
event     N%      time to detection  p/Grimes p/piu
PRISM     30'000   6 years           4.09e-6  4.11e-6
Syphilis   6'700  25 years           4.20e-6  4.58e-6
FBI          500   6 years           2.45e-4  2.48e-4

calculation program

 

'#Mat 0
7Exp77->a~z
7Exp77->A~Z
"N "?->N%'population
1Exp(-)4->a'a,b-para mortality
0.085->b
40->a%'age at start
4Exp(-)6->p'prob. of a leak
52->w'week per year
N%->n
1->g
0->h'hidden 95%?
0->H'hidden 50%?
Gosub G
For 0->i% To 80'years
 For 0->j% To w-1 'weeks
  i%+j%/w->t
  ae^(b(t+a%))->m'prob of mortality 
  n(1-m/w)->n'n step by step.
  1-(1-p)^n->f
  g(1-f/w)->g
  1-g->l
  Black Plot t,l
  If l>0.95 
   h<0.001=>t->h
  IfEnd
  If l>0.50 
   H<0.001=>t->H
  IfEnd
 Next
Next
Gosub S
Disp "95%",h,"50%",H
Stop


Lbl G
ClrGraph:CoordOff:AxesOff:GridOff:LabelOff:S-L-Normal:Rad:'#_SketchThin _
AxesOn
' x0 x\1 dx y0 y\1 dy
ViewWindow 0,60,10,0,1,0.2
Return 
'Print._X_Y
Lbl P
Text 1,9,"                               "
Text 1,9,X
Text 1,179,Y
Return 
'Stop
Lbl S
Plot :Text 1,1,">"Disps
While Getkey<>31:WhileEnd'exit=47
Return 

Analysis programm. I used the bisection method for calculation. This bisection program is useful for may tasks. So I used varaibales in the main program which tend to be used rarely:

Usually, I don't  use Lists, but Matrices. Here I used a list for the upper and lower values of X and Y (which is p and the difference between observed and calculated time to detection here).
I used X and Y which are less useful because they are changed when a plot command is used.

 

'#Mat 0
7Exp77->a~z
7Exp77->A~Z
500->N%'Population
6->T'time to detection
'
4->Dim List 1
0.1->X
Gosub f
X->List 1[0]
Y->List 1[1]
If Y>0
 "change x\1 x\2"
 Stop
IfEnd
1Exp(-)7->X
Gosub f
X->List 1[2]
Y->List 1[3]
If Y<0
 "no root"
 Stop
IfEnd
For 1->z% To 10
 Sqrt(List 1[0]*List 1[2])->X
 Gosub f
 If Y<0
  X->List 1[0]
  Y->List 1[1]
 Else 
  X->List 1[2]
  Y->List 1[3]
 IfEnd
 Disp "p deltaT",X,Y
Next 
Disp "result",Sqrt(List 1[0]*List 1[2])
Stop


'
Lbl f
X->p'prob. of a leak
1Exp(-)4->a'a,b-para mortality
0.085->b
40->a%'age at start
52->w
N%->n
1->g
0->h'hidden 95%?
0->H'hidden 50%?
For 0->i% To 80'years
 For 0->j% To w-1 'weeks
  i%+j%/w->t
  ae^(b(t+a%))->m'prob of mortality
  n(1-m/w)->n'n step by step.
  1-(1-p)^n->f
  g(1-f/w)->g
  1-g->l
  If l>0.95 
   h<0.001=>t->h
  IfEnd
  If l>0.50 
   H<0.001=>t->H
  IfEnd
 Next
Next
If H<0.001Then 
 999->H'infinity
IfEnd
H-T->Y
Return 


#450 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 04 November 2019 - 02:54 AM

@piu58
Thank you very much again for the very interesting program. :D
I enjoyed it by changing the value of N.
Another interesting thing is that the results converge during a realistic waiting time. ^_^
 
Personally, when I first saw the moon hoax, I thought it was a very interesting theme. :P
 
 
 
Here is new little updated version. :)
 
2.33 beta  for 9860G/9860GII series.
        -Fixed the bug that the cursor position jumps when canceling by Shift from clip mode of standard font editor.
        -Fixed the bug that freezes when F2/F3 is pressed in Shift+F3+F5 hex dump mode.
 
1.33 beta for CG10/20/50/Graph90+E.
        -Fixed the bug that color was not initialized after Plot command.


#451 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 122 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G, Casio fx-CG20

Posted 07 November 2019 - 12:14 PM

Dear Sentaro.

 

I use the CG-20 quite often. Probably, I can put the next program here in the near future.

 

I have a proposal for a definite improvement, which may be added rather simple.

 

We have often the problem that we have to change something at a particular line in the program- The we try it out and have to improve it further. This type of editing is the most one when remove errors.

It would be nice if the editor starts at the place I left it. So I don't have to skip every time to that line.

 

Thank you in advance, Uwe.



#452 CalcLoverHK

CalcLoverHK

    Casio Freak

  • Members
  • PipPipPipPip
  • 187 posts
  • Gender:Male
  • Location:Hong Kong
  • Interests:Playing video games (especially Minecraft), calculators, programming (Casio Basic/C.Basic, Scratch), watching memes, IT research, mathematics...

  • Calculators:
    fx-50FHII
    fx-9860GII Emulator (expired)
    fx-CG50 Emulator (expired)

Posted 07 November 2019 - 12:21 PM

Hi sentaro21,

What is the usage of [,M] in extended command "?" in C.Basic CG manual? There is no clear description of this feature.

And what is the range of x and y in "?" command? I saw that it can be ux and uy / px and py.

Cheers,
CalcLoverHK

Edited by CalcLoverHK, 07 November 2019 - 12:44 PM.


#453 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 08 November 2019 - 05:37 AM

@piu58
Ok!
I would like to update to save the cursor position after exiting the editor. ^_^
Please wait for a while.
 
 
@CalcLoverHK
The [,M] extended option of the "?" command can be entered using the mini font. :)
"A="?(@30,40,5,">",5,,M)->A
 
The range of X and Y in "?" command is usually Locate coordinates.
"A="?(3,4,5,">",5)->A
 
However when @ option is added, it becomes graphics coordinate.
"A="?(@30,40,5,">",5)->A

 



#454 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 10 November 2019 - 07:26 AM

Here is new updated version. ^_^
 
2.34 beta  for 9860G/9860GII series.
        -Changed the specification of editor that when the file is opened again, the cursor position comes to the same place.
         (Up to 7 files are supported.)
        -Fixed the bug that sub-program disappear after program interruption when the Help function is enabled.
 
 
1.34 beta for CG10/20/50/Graph90+E.
        -Changed the specification of editor that when the file is opened again, the cursor position comes to the same place.
         (Up to 16 files are supported.)
        -Fixed the bug that sub-program disappear after program interruption when the Help function is enabled.


#455 CalcLoverHK

CalcLoverHK

    Casio Freak

  • Members
  • PipPipPipPip
  • 187 posts
  • Gender:Male
  • Location:Hong Kong
  • Interests:Playing video games (especially Minecraft), calculators, programming (Casio Basic/C.Basic, Scratch), watching memes, IT research, mathematics...

  • Calculators:
    fx-50FHII
    fx-9860GII Emulator (expired)
    fx-CG50 Emulator (expired)

Posted 10 November 2019 - 11:49 AM

Hi sentaro21,

 

For Local command,

  • Can I set one Local variable only? (Like Local x)
  • If the no. of Local variables don't match to the no. of value Prog assign, does it run into an error?

E.g.

Local a,b,c,d

Prog "TEST",12,10

Cheers,
CalcLoverHK


Edited by CalcLoverHK, 10 November 2019 - 12:03 PM.


#456 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 10 November 2019 - 12:47 PM

Yes!
You can set one local variable only. ^_^
 
Local variables are valid in sub-programs.
Local commands are basically used on the sub-program side.
It is used as the sub-program argument in order from the first variable. :)
// main program
Prog "TEST",10
Prog "TEST",20
stop
 
// Sub program "TEST"
Local a
Disp a*3
The result is,
30
60

 



#457 CalcLoverHK

CalcLoverHK

    Casio Freak

  • Members
  • PipPipPipPip
  • 187 posts
  • Gender:Male
  • Location:Hong Kong
  • Interests:Playing video games (especially Minecraft), calculators, programming (Casio Basic/C.Basic, Scratch), watching memes, IT research, mathematics...

  • Calculators:
    fx-50FHII
    fx-9860GII Emulator (expired)
    fx-CG50 Emulator (expired)

Posted 10 November 2019 - 01:40 PM

Hi sentaro21,

 

So the "a" of Local a takes the value 10 in Prog "TEST",10; And 20 in Prog "TEST",20?

 

One more question, based on this situation,

'Main
'1.
Prog "TEST",10,,2,   //I leave the "b" and "d" blank, so does the last comma vaild?
'2.
Prog "TEST",3,5   //Does it mean a=3, b=5 and remaining variables=0?
'3.
Prog "TEST",1,2,3,4,5   //I exceed the no. of assignments (no. of value > Local variables)

"TEST"
Local a,b,c,d
a+b+c+d

So are the results in a+b+c+d:

1. 12?

2. Error/8?

3. Error/Something else?

 

Cheers,

CalcLoverHK



#458 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 11 November 2019 - 12:17 AM

So the "a" of Local a takes the value 10 in Prog "TEST",10; And 20 in Prog "TEST",20?

 

Yes! ^_^

 

 

1. The argument cannot be omitted.
 and the last comma is invalid and an error.
 
2.The arguments are valid only for a and b,
 c and d are not changed and the previous local values are used in sub-program.
 
3.The last argument is ignored.
 
I reconfirmed the arguments of Prog command.
Thanks! :D


#459 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 11 November 2019 - 07:56 AM

Fixed the mistake that did not return to the previous cursor position after program execution. ^_^
 
2.34 beta  for 9860G/9860GII series.
 
1.34 beta for CG10/20/50/Graph90+E.


#460 Krtyski

Krtyski

    Casio Freak

  • Members
  • PipPipPipPip
  • 122 posts
  • Gender:Male
  • Location:Tokyo, Japan
  • Interests:programming, smooth Jazz and 4-wheel driving.

  • Calculators:
    FX-502P, FX-602P, FX-603P,
    fx-4000P, fx-7000G,
    fx-4500P, fx-4800P
    fx-5800P,
    CFX-9850G,
    CFX-9850GC PLUS
    fx-9860G,
    fx-9860G AU,
    fx-9860G Slim
    fx-9860GII SD,
    fx-9860GII-2,
    fx-9860GII-2 SD,
    fx-CG20, fx-CG50,
    fx-CP400

Posted 11 November 2019 - 08:16 AM

Hi sentaro21

 

The new "cursor position save" function is lovely. Once I know the function I realized this is what I exactly need for long time.

Alpha+[(-)] for input of % is also useful.

 

Thanks



#461 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 11 November 2019 - 11:30 AM

Hi sentaro21

 

The new "cursor position save" function is lovely. Once I know the function I realized this is what I exactly need for long time.

Alpha+[(-)] for input of % is also useful.

 

Thanks

 

Thanks! :D

I'm glad you liked them.

I would like to thank piu58 for their valuable suggestions. ^_^



#462 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 12 November 2019 - 07:40 AM

Sorry,
There was a fatal bug in the FX version. :bow:
 
2.35 beta  for 9860G/9860GII series.
        -Fixed the bug that Clip & Paste of the matrix editor stopped working due to memory exhaustion error. (Enbug in 1.88)
        -Fixed the bug that the file size becomes +1 by the Save command of the character string.
(example) Load "test.txt"->Str 1
                  Save("Test.txt"),Str 1
         The file size of "Test.txt" is increased by 1 byte.
 
1.35 beta for CG10/20/50/Graph90+E.
        -Fixed the bug that the file size becomes +1 by the Save command of the character string.
(example) Load "test.txt"->Str 1
                  Save("Test.txt"),Str 1
         The file size of "Test.txt" is increased by 1 byte.


#463 CalcLoverHK

CalcLoverHK

    Casio Freak

  • Members
  • PipPipPipPip
  • 187 posts
  • Gender:Male
  • Location:Hong Kong
  • Interests:Playing video games (especially Minecraft), calculators, programming (Casio Basic/C.Basic, Scratch), watching memes, IT research, mathematics...

  • Calculators:
    fx-50FHII
    fx-9860GII Emulator (expired)
    fx-CG50 Emulator (expired)

Posted 12 November 2019 - 01:10 PM

Hi sentaro21

Just took some times to investigate the feature added few days ago (I'm preparing for exams so have little time) and instantly fell in love with it. It adds so much conveniences especially when writing commands only in calculator.

I will add description of it in my ongoing User's Guide.

Cheers
CalcLoverHK

#464 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 122 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G, Casio fx-CG20

Posted 12 November 2019 - 01:51 PM

I tried to experiment with wavelet optics. My aim is the calculation of optical aberrations and how they change the diffraction pattern.

 

I just started with the simplest case of wavelet optics - diffraction at a slit. I stored the program at planète casio, because they have a program library there.

https://www.planet-c...php?showid=3959



#465 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 13 November 2019 - 06:48 AM

@CalcLoverHK
Thanks! :D
Good luck with exams. ^_^
 
 
@piu58
Thanks for new application for C.Basic. :D
It's nice to upload the program to the Planet-Casio library. ^_^
and 
Your suggestion was very good. Thank you again! :D
 
 
Here is new updated version.
This update makes cursor movement smoother. ^_^
 
2.36 beta  for 9860G/9860GII series.
-Improved the display frequency of the mini font cursor of the editor.
 
1.36 beta for CG10/20/50/Graph90+E.
-Improved the display frequency of the cursor of the editor.
 
(edited 14/11/2019)
Since the 2.34/1.34 ,There was a serious enbug that caused text conversion twice when running the program, resulting in a memory shortage. :bow:
I fix it and re-updated.
Please re-download 2.36 & 1.36. ^_^
 

Edited by sentaro21, 13 November 2019 - 11:54 PM.


#466 Emex

Emex

    Casio Addict

  • Members
  • PipPipPip
  • 51 posts
  • Gender:Not Telling
  • Location:.#[Location]
  • Interests:.#[Interests]

  • Calculators:
    .#[Calculators]

Posted 15 November 2019 - 05:40 AM

I'll be giving C.Basic another try today, after such a long time c:

Seems like a ton of updates came to be!



#467 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 15 November 2019 - 07:08 AM

Thanks! :D
 
Some bug fixes and feature additions have been made.
Still, it has always been C.Basic. ^_^


#468 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 122 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G, Casio fx-CG20

Posted 15 November 2019 - 10:57 AM

I just stores a new C.Basic program to the library at planet Casio. Please load it (and the image) form there.

https://www.planet-c...php?showid=3962

 

My description there:

 

requires C.Basic)

Wave optics is cool. You don't need to know the law of reflection - the waves know from their self where they have to go.
They only thing you need to know is
- every point of a wave front emittes a wavelet (that is a spherical wave)
- wavelet interfere (at every point), constructive or destructive
- the speed of light in glass or another medium is c/n. n is the refractive index
We don't need the last rule for this calculation here.



The main idea behind this is that every point generates a wavelet, which is a spherical wave. This waves goes to everywhere. There are places where more waves met and increase each other, and other places where they are lost by destructive interference. All you have to do is to measure the optical path of each wavelet.

I started with the program of a slit. Now I came to a more important example: The calculation of the Airy disc. I started (again with something simple), with a parabloid mirror like used in a Newtonian telescope.

If you try to understand how the program works I recommend consulting the accompanying sketch.

In front of the mirror we have / we assume a flat and coherent wave front. All rays here are parallel. The optical path need is the amount of "g" to the mirror and then the amount of "q" to the screen. From everywhere of the mirror's surface goes a wavalet which hit the srceen at the actual (red dot) place. This rays interfere.

My calculation assumes that the central (blue) ray has always a maximum amplitude. The phase shift of all the other rays calculates form the differences in the optical path.
The optical path of the blue ray is the line form the incoming wave to the mirror G and the line Q form the center of the parabloid to our point. The value of G is the so called the mirrors sagitta, which can be calculated by
G = A²/(4*f), where A is the aperture and f the focal length.
For the optical path of the green ray we need the value of g. This is the difference between the sagitta and thy y coordinate of the mirror. The y coordinate depends form the distance to the center of the mirror, which is r in my program. I first calculate the "height" of the mirror, which is y = x²/4f. In principle, this is the same formula which I used for the sagitta.

The difference between the tracking of the rays is f. Multiplied with 2*pi whe get the phase angle of the wavelet at the screen.

The summation of the amplitude values does not give the intensity of the light at the places of the screen. The amplitude value needs to be squared for the intensity. The reason is, that light is an electromagnetic wave which consists of an electric and a magnetic component. The intensity is the Cartesian product of them, the so called Poynting vector.

I gave the program in the simplest form. You may experiment with it and try, whether the diameter of the airy disc and the intensity of the first ring follows the exceptions. The Airy disc has the size 2.44 * lambda * f / A, the first ring has an intensity of 1.75% independent of the Aperture and focal length. The values are not very accurate in the given program. But if you increase the number of points in each direction to 30 or even 100, all things look much better. The calculator runs for a few hours then.

You may experimenting further: What happens if the mirror has a central obstruction (which it has in most cases)? Simply modify the line If r<=A/2 . What happens if you are not in focus? Just add something to the Y term in the Q,q formula and increase the width of the screen w. You get a diffraction pattern then, sich patterns are used for testing optics.

You may experiment further and look what happens with an oblique wave front - just add and subtract something to the values of g. The problem is not symmetric anymore and you need to calculate a real image plane. not just a line. This takes a while with the pocket calculator.



#469 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 17 November 2019 - 08:23 AM

Thank you for interesting themes and programs. :D
 
Airy Disc is a very interesting theme.
I knew the general outline before, but I wanted to know more about it this time, so I researched it on the web. :P
I'm glad that it can be calculated easily with the calculator at hand. ^_^
 


#470 CalcLoverHK

CalcLoverHK

    Casio Freak

  • Members
  • PipPipPipPip
  • 187 posts
  • Gender:Male
  • Location:Hong Kong
  • Interests:Playing video games (especially Minecraft), calculators, programming (Casio Basic/C.Basic, Scratch), watching memes, IT research, mathematics...

  • Calculators:
    fx-50FHII
    fx-9860GII Emulator (expired)
    fx-CG50 Emulator (expired)

Posted 17 November 2019 - 09:36 AM

Hi sentaro21

 

What are "JIS_to_GB_Tbl.txt", "Message.txt" and "setup_format.txt" used for?

 

Cheers

CalcLoverHK


Edited by CalcLoverHK, 17 November 2019 - 10:50 AM.


#471 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 17 November 2019 - 11:19 AM

Ok!
 
"JIS_to_GB_Tbl.txt"
This is prepared for Japanese,and is corresponds to Japanese JIS code and Chinese simplified GB code built into the CG series. ^_^
 
To use GB font, set "Edit GB Font" to On or Full by Setup,
F5(CHAR)-[X^2] or [^]
 
 
"Message.txt"
This is internal information.
A list of messages displayed in C.Basic.
 
 
"setup_format.txt"
This is the internal structure information of the setup.
This is for development purposes. ^_^


#472 Krtyski

Krtyski

    Casio Freak

  • Members
  • PipPipPipPip
  • 122 posts
  • Gender:Male
  • Location:Tokyo, Japan
  • Interests:programming, smooth Jazz and 4-wheel driving.

  • Calculators:
    FX-502P, FX-602P, FX-603P,
    fx-4000P, fx-7000G,
    fx-4500P, fx-4800P
    fx-5800P,
    CFX-9850G,
    CFX-9850GC PLUS
    fx-9860G,
    fx-9860G AU,
    fx-9860G Slim
    fx-9860GII SD,
    fx-9860GII-2,
    fx-9860GII-2 SD,
    fx-CG20, fx-CG50,
    fx-CP400

Posted 19 November 2019 - 02:40 AM

Hello CalcLoverHK

 

Let me show you an example of program using Japanese characters in C.Basic program.

In the following page (sorry in Japanese) there are some screen shots and as you can see Japanese characters are used.

These characters are selected in GB code table.

https://egadget.blog...-entry-681.html

Google translation may help you for translation.

 

Casio is Japanese company but fx-CG50 does not include Japanese character code in there, sad.

So in order to use Japanese characters, a function of showing list of GB code characters is prepared, then you can pick up characters you want from the list and can embed the characters in your program.


Edited by Krtyski, 19 November 2019 - 02:43 AM.


#473 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 19 November 2019 - 11:24 AM

@Krtyski
Thank you for more detailed explanation. :D
 
 
Here is new updated version. ^_^
 
2.37 beta  for for 9860G/GII series/Graph 35+USB/35+EII/75/85/95 (SD)
        -Fixed the StoPict bug that the PICT file size was increased by 12 bytes (2080 bytes, correctly 2068 bytes) when saveing to main memory.
        -Fixed the StoPict bug that the PICT file was not saving to storage memory.
 
1.37 beta for CG10/20/50/Graph90+E.
        -Fixed the StoPict bug that the PICT file was not saving to storage memory of G1M mode.
 
--Same update--
        -Fixed the bug where the space in comments was deleted when "Save-" of "Edit +Indent" was set in the setup.
        -Fixed the bug that an error occurred when copying to Str variable when the length of the list label was 8 characters.
        (example) "ABCDEFGH"->List 1[0]
                  List 1[0]->Str 1


#474 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 21 November 2019 - 11:13 AM

Sorry for the bugs remaining. :bow:
Here is new updated version. ^_^
 
2.38 beta  for for 9860G/GII series/Graph 35+USB/35+EII/75/85/95 (SD)
        -Fixed the editor bug that the screen is shifted down when pasting on the 6th line when the upper status bar is displayed in the editor.
 
1.38 beta for CG10/20/50/Graph90+E.
 
--Same update--
        -Fixed the bug that the order of files with period characters in the name was reversed.
        -Fixed the editor bug that could not be edited when the stored cursor position was after the end of the file.
        -Fixed the RclPict bug that full 2KB Pict loading from storage memory.


#475 CalcLoverHK

CalcLoverHK

    Casio Freak

  • Members
  • PipPipPipPip
  • 187 posts
  • Gender:Male
  • Location:Hong Kong
  • Interests:Playing video games (especially Minecraft), calculators, programming (Casio Basic/C.Basic, Scratch), watching memes, IT research, mathematics...

  • Calculators:
    fx-50FHII
    fx-9860GII Emulator (expired)
    fx-CG50 Emulator (expired)

Posted 21 November 2019 - 02:05 PM

Hi Krtyski

May I use your slogan "Anytime Anywhere Computing" on my ongoing project and some descriptions on C.Basic of your FC2 blogs? Thanks a lot.

Cheers
CalcLoverHK

#476 Krtyski

Krtyski

    Casio Freak

  • Members
  • PipPipPipPip
  • 122 posts
  • Gender:Male
  • Location:Tokyo, Japan
  • Interests:programming, smooth Jazz and 4-wheel driving.

  • Calculators:
    FX-502P, FX-602P, FX-603P,
    fx-4000P, fx-7000G,
    fx-4500P, fx-4800P
    fx-5800P,
    CFX-9850G,
    CFX-9850GC PLUS
    fx-9860G,
    fx-9860G AU,
    fx-9860G Slim
    fx-9860GII SD,
    fx-9860GII-2,
    fx-9860GII-2 SD,
    fx-CG20, fx-CG50,
    fx-CP400

Posted 22 November 2019 - 05:07 AM

Hi CalcLoverHK

 

Hi Krtyski

May I use your slogan "Anytime Anywhere Computing" on my ongoing project and some descriptions on C.Basic of your FC2 blogs? Thanks a lot.

Cheers
CalcLoverHK

 

No problem!

Please use the slogan freely.

 

Referring a paragraph or longer from my FC2 blog, I'm very happy if you write reference somewhere in the document (for example write only once in very end of the document). The reference may be "source: e-Gadget, a FC2 blog by Krtyski" or something like this.


Edited by Krtyski, 22 November 2019 - 05:12 AM.


#477 CalcLoverHK

CalcLoverHK

    Casio Freak

  • Members
  • PipPipPipPip
  • 187 posts
  • Gender:Male
  • Location:Hong Kong
  • Interests:Playing video games (especially Minecraft), calculators, programming (Casio Basic/C.Basic, Scratch), watching memes, IT research, mathematics...

  • Calculators:
    fx-50FHII
    fx-9860GII Emulator (expired)
    fx-CG50 Emulator (expired)

Posted 22 November 2019 - 04:46 PM

Hi Krtyski and sentaro21

Well, sentaro21 helped me include the acknowledgement of both your instructions and FC2 blog entry, so it has been done.

And I want to clarify one thing about the display.

You said:
"Graphics Screen of fx-9860GII has 127 pixel x 63 pixel display area. Graphics Screen of fx-CG20/10 has 379 pixel x 187 pixel display area."

But in CG manual said CG series has 384*216 area, and in FX manual there is nothing about it. Which information applies to current C.Basic?

Or in another words, what resolution does FX/CG have (no matter some part of pixels are unused or not)? Which functions does each part of pixels d?

Cheers
CalcLoverHK

#478 sentaro21

sentaro21

    Casio Freak

  • Members
  • PipPipPipPip
  • 295 posts
  • Gender:Male
  • Location:JAPAN

  • Calculators:
    FX-603P fx-4800P fx-5800P
    CFX-9850GC PLUS
    fx-9860G
    fx-9860GII
    fx-9860GII-2
    fx-9860GII-2 SD
    fx-CG10
    fx-CG20
    fx-CG50
    HP-Prime
    HP 50G
    TI-Nspire CX CAS
    TI-84+CE

Posted 23 November 2019 - 04:31 AM

@CalcLoverHK
Thanks always. :D
 
FX has the 128x64 area in LCD.
In genuine graphics commands, the top and left one dots are not used, so it is 127x63.
 
In CG, the actual resolution of LCD is 396x224.
Of these, 
384x216 area excluding the 6-dot frame on the left and right and the bottom, is an accessible area in C.Basic.
And,
384x192 area excluding the upper 24 dots (status area) is usually used in Basic.
And the graphics command can only use the 379x187 area excluding the top and left 5 dots.
This is for compatibility from the FX version. ^_^


#479 Krtyski

Krtyski

    Casio Freak

  • Members
  • PipPipPipPip
  • 122 posts
  • Gender:Male
  • Location:Tokyo, Japan
  • Interests:programming, smooth Jazz and 4-wheel driving.

  • Calculators:
    FX-502P, FX-602P, FX-603P,
    fx-4000P, fx-7000G,
    fx-4500P, fx-4800P
    fx-5800P,
    CFX-9850G,
    CFX-9850GC PLUS
    fx-9860G,
    fx-9860G AU,
    fx-9860G Slim
    fx-9860GII SD,
    fx-9860GII-2,
    fx-9860GII-2 SD,
    fx-CG20, fx-CG50,
    fx-CP400

Posted 23 November 2019 - 09:27 AM

Hi CalcLoverHK

 

Genuine Casio Basic has limitation for accessible area by graphics commands. This is for displaying cross cursor when access very left and very top line of the  accessible area.

 

However C.Basic can access entire area of LCD.

 

For details, please see comment of sentaro21.

 

Thanks 


 

Well, sentaro21 helped me include the acknowledgement of both your instructions and FC2 blog entry, so it has been done.

 

It's completely OK. Thank you for your consideration.


Edited by Krtyski, 23 November 2019 - 09:27 AM.


#480 CalcLoverHK

CalcLoverHK

    Casio Freak

  • Members
  • PipPipPipPip
  • 187 posts
  • Gender:Male
  • Location:Hong Kong
  • Interests:Playing video games (especially Minecraft), calculators, programming (Casio Basic/C.Basic, Scratch), watching memes, IT research, mathematics...

  • Calculators:
    fx-50FHII
    fx-9860GII Emulator (expired)
    fx-CG50 Emulator (expired)

Posted 23 November 2019 - 05:19 PM

Hi sentaro21

 

What is [height] used for in Locate command? I didn't see anything on manual.

And is "withot" in "While withot WEnd" a typo or intended?

 

Cheers

CalcLoverHK







Also tagged with one or more of these keywords: Casio Basic C.Basic

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users