Jump to content



Photo
* * * * * 4 votes

C.Basic - International Release

Casio Basic C.Basic

  • Please log in to reply
702 replies to this topic

#201 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 May 2019 - 09:19 AM

Thanks very much!!
I'm very happy to know how C.Basic is useful. :D
 
C.Basic can be fully used with GII and later models,
The 9860G has the high contrast easy-to-see screen.
The 9860G Slim has the largest LCD screen in the series with backlight.
I will continue to support all series in the future. :)
 
Re-updated v1.98beta again.
Please download again. :bow:
 
for 9860G/9860GII series.
https://pm.matrix.jp...ASIC198beta.zip (re-uploaded) 07 May 2019
-Added pop-up when external font is not enabled in SetFont 1.
 
-Changed specification of maximum loop stack level.
 (for~Next       :upto 4 level -> 7)
 (While~WhileEnd :upto 6 level -> 7)
 (Do=LpWhile     :upto 6 level -> 7)
 (Switch~SwitchEnd:upto 4 level -> 7)
 
 
(edit)
New bug found and re-updated. :bow:   
Please replace the previous 1.98beta immediately.
 
-Fixed the bug that external font may be broken when using the hidden memory.
-Fixed the bug that caused memory error of input "?" command of string.

Edited by sentaro21, 07 May 2019 - 06:59 AM.


#202 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 13 May 2019 - 10:28 AM

Dear Sentaro,

 

for you next change in C.Basic: Could you please repair a small mistake? I often use the >txt function to get a printable version of the program. When converting, the display Stop Sign (Δ) will be replaced by "Disps" . In the normal listing this contains a newline. In the ascii text, there is no newline. Is there a way to repair this? I know you may have problems with the NL if you start a program for text mode and rearranges this to a .g1m code.

It would be a nice idea too, if we could have a single symbol for display stop. Of course, this should not be used otherwise.

 

Thank you again, Uwe



#203 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 14 May 2019 - 07:19 AM

Just another mistake. C.Basic differs form Casio Basic.

I have a program which presents intermediate results in form of a list, with DisplayStop. If I press Exe, the result is still visible at Casio Basic. In C.Basic the program clears the screen (not as problematic) but writes Done. I thought first, the program finished.

Here is the program which I changed so it can be used in both Basic interpreters:

1.5->Q
Q*(1+1Exp(-)8)->R
0->F
1Exp(-)5->D
Do
For 1->J To 1000
RRRR(Q-1)/QQQ->Z
Z-R(R-1)->Z
Z->E
R+ED->R
F+D->F
Next
{R,180F/pi}DispsLpWhile R<10

You see the Disps-Error here too: The LpWhile deserves an own line :)

 

I made screenshots of both program, started after the first stop:

fx.jpg



#204 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 14 May 2019 - 12:35 PM

Hi piu58  :D

Thanks very much for bug report.

I confirmed the bug.
I will fix it in the next update. :)


#205 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 14 May 2019 - 01:06 PM

Here is new updated version. :)
 
for 9860G/9860GII series.
        -Fixed the bug that clear display after the Mat and List were paused.
 
        -Changed specification of text conversion of "Disps" command to add [CR][LF] code.
         (Previous = compatible with CG series) Disps
         (New specification) Disps+[CR]+[LF]
 
        -Added the key combination that easy to move between storage memory and Main Memory.
         Shift-F5 to change Strage/SD <-> main memory(Main Memory).
        -Added the specification that up to 7 favorite files can be registered separately for storage memory and SD ans main memory (Main Memory).
 
        -Fixed the bug that debug mode is not canceled when break and then edited. (bugs remaining.)
 
        -Added Rotate&Zoom option of _Rectangle/_Polygon command.
        (format)_Rectangle x1,y1,x2,y2, border_width, border_color, fill_color[,chance/brend%][,angle][,center_X][,center_Y][,zoom%]
        (format)_Polygon *ary_x, *ary_y, vertices, color[,chance/brend%][,angle][,center_X][,center_Y][,zoom%]
 
        If [center_X][center_Y] are omitted, The center of the drawn image is specified.
 
        (example ) see "C.Basic_sample/ML_sample" folder.
 
        -Changed "MCS" notation to "Main Memory".
 
 
for CG10/20/50/Graph90+E version.
        -Fixed the bug that clear display after the Mat and List were paused.
 
        -Added the specification that up to 7 favorite files can be registered separately for storage memory and Main Memory.
 
        -Changed specification of text conversion of "Disps" command to add [CR][LF] code.
         (Previous = compatible with CG series) Disps
         (New specification) Disps+[CR]+[LF]
 
        -Fixed the bug that debug mode is not canceled when break and then edited. (bugs remaining.)
 
        -Changed "MCS" notation to "Main Memory".
 
        -Added the key combination that easy to move between storage memory and Main Memory.
         Shift-F5 to change Strage <-> Main Memory).
 
        -Added Rotate&Zoom option of _Rectangle/_Polygon command.
        (format)_Rectangle x1,y1,x2,y2, border_width, border_color, fill_color[,chance/brend%][,angle][,center_X][,center_Y][,zoom%]
        (format)_Polygon *ary_x, *ary_y, vertices, color[,chance/brend%][,angle][,center_X][,center_Y][,zoom%]
 
        If [center_X][center_Y] are omitted, The center of the drawn image is specified.
 
        (example ) see "ML_sampleCG" folder.
 
        -Fixed the bug that drawing color option 5 (Transmittance setting) of ML command did not work with the following commands.
         _Horizontal
         _Vertical
         _Recangle
         _FillPolygon

 



#206 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 15 May 2019 - 04:32 AM

That was fast! I replaced the version in both of my calculators. Looks fine now.



#207 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 16 May 2019 - 04:27 AM

That was fast! I replaced the version in both of my calculators. Looks fine now.

Thanks!! :D
 
I'm sorry every time. A bug was found. :bow:
This is a fixed update.
 
1.99.3beta  for 9860G/9860GII series.
https://pm.matrix.jp...ASIC199beta.zip  (18/5/2019 re-updated )
        -Fixed the bug that debug mode is not canceled when break and then edited with Help On.
 
        -Fixed the bug that exiting without go to editor when AC/onbreak stopping sub-program and press EXIT(enbug in 1.98)
 
        -Fixed the bug that was unable to switch favorites list when Max Mem Mode was ON.
        -Changed specification that the favorites list display from the bottom when move Storage/SD from Main Memory.
        -Fixed the bug that variable display after the Mat and List were paused.(enbug in 1.99)
 
 
0.85alpha  for CG10/20/50/Graph90+E version.
https://pm.matrix.jp...CBASICCG085.zip    (19/5/2019 re-updated )
        -Fixed the bug that debug mode is not canceled when break and then edited with Help On.
 
        -Fixed the bug that exiting without go to editor when AC/onbreak stopping sub-program and press EXIT(enbug in 0.82)
 
        -Changed specification that the favorites list display from the bottom when move Storage/SD from Main Memory.
        -Fixed the bug that variable display after the Mat and List were paused.(enbug in 0.85)
 

Edited by sentaro21, 19 May 2019 - 12:29 AM.


#208 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 26 May 2019 - 12:29 PM

Here is new updated. :)
 
1.99.4 beta for 9860G/9860GII series.
        -Fixed the drawing bug of Graph(X,Y) with argument of TTheta variable.
        -Added moved to the top of the folder list when pressing the [.]Key of the file list.
 
0.86 alpha for CG10/20/50/Graph90+E version.
        -Fixed the drawing bug of Graph(X,Y) with argument of TTheta variable.
        -Added moved to the top of the folder list when pressing the [.]Key of the file list.
        -Fixed the bug that the external font was disabled in the FX(6x8 font) option of the Text command.
 
Please see this folder.
/CBasic_sample/GRAPHXY_sample/


#209 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 28 May 2019 - 06:24 AM

I just installed it on moth of my fx-9860.

 

Beside this, I tried to find out how I need to write my programs that they work with the 9860 AND the Prizm. Most important are the differences in the graph screen. As some of you know, I need scientifci graphic rather than images and games. I don't have the Prizm yet, but I used a simulator for the first experiments. I don't have C.Basic at this simulator of course, but the graphics can be exploited with casioBasic.

 

I found out, that the strange behavior, that the last plottet point is not shown, was cultivated in the Prizm too. 

There were some changes in my small graphic  environment necessary. The most important was that I moved the status line form the bottom of the top. In this line I can give numbers which show the course of the calculation. The bottom is at different coordinates now, but the top starts from 1.

I tried to find a way to sketch small pixels with plot. This did not work - pixels are 4x4 always. But FLine with length 0 may be used instead, and the line thickness can be set to thin. The Fline works on bot calculators. The S-L-Thin of course not.

 

If somebody is interested, I may give a program here which calculates the light bending in the near of a black hole. I need some days more to make it ready for both calculators.



#210 pan.gejt

pan.gejt

    Casio Freak

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

  • Calculators:
    .

Posted 28 May 2019 - 07:14 AM

I am interested in such program. I am looking forward to have it in my calc. :-)



#211 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 May 2019 - 12:55 AM

@piu58
Thansk always!!
I'm interested in your program as well as @pan.gejt.  :D
 
C.Basic for CG is more compatible with FX version of C.Basic than genuin Casio Basic for CG. :P
Support for expanded graphics of genuine Casio Basic for CG is delayed. :bow:
 
Basically, all programs that run in the C.Basic for FX work well in the same way in the CG version.
This is a feature not found in genuine Casio Basic for CG.
 
In genuine Basic, the Plot dots get thicker for compatibility with the FX,
In C.Basic it is possible to avoid that. ^_^
 
This code will make the Plot dots from 3x3 to 1x1.
SketchThin Plot
Or,to specify the whole program
'#SketchThin
 
C.Basic for CG also works in the emulator. :)
(Please import CBCGxxx.g3a from F3(PC) of memory manager)
 


#212 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 29 May 2019 - 09:17 AM

At first the program, made with the fx9860G. I still wait for the Prizm, may be it comes today. C.Basic is needed!
 

'ProgramMode:RUN
'photon in bended space
"q"?->q
Gosub G
Gosub c
q*(1+1Exp(-)8)->r
0->f
1Exp(-)3->d
Do
 For 1->j To 10
  rrrr(q-1)/qqq->z
  z-r(r-1)->z
  If z<=0:Then :9999->X:Gosub P:Goto S:IfEnd
  Sqrtz->e
  r->R:f->F
  r+ed->r
  f+d->f
 Next
 rsin f->x:rcos f->y
 x-Rsin F->a:y-Rcos F->b
 Sqrt(aa+bb)->A
 (ay-bx)/A->Y
 r->X:Gosub P
 Plot rsin f,rcos f
 LpWhile r<10
Goto S
Stop
 
'circle
Lbl c
For 0->i To 2pi Step 0.1
 Plot sin i,cos i
Next
Return 
'Init
Lbl G
ClrGraph:CoordOff:AxesOff:GridOff:LabelOff:S-L-Normal:Rad
'_AxesOn_
ViewWindow (-)10,10,1,-5,5,1
Return 
'Print.XY
Lbl P
Text 1,9,"                     "
Text 1,9,X
Text 1,79,Y
Return 
Lbl S
Plot :Text 1,1,">"Disps

Some explanations:

The path of the light cannot be described by a simple formula. We have a differential equation instead. It is not a complicated one.
It means, we have a formula which gives the changes of the path at every point, and not the path itself which the photon takes. The formula is in r and phi, that means it gives the changes in r if we change the angle around the black hole a little bit. Mathematical that is (d r)/(d phi), or dr/df in the terms of my program, phi is f here. This formula contains the nearast distance of the photon to the black hole, which I named q. The forula is


                                                                                                       rrrr(q-1)

dr/df = √ ( ---------- - r(r-1) )
                                                                                                       qqq

If you are interested in a derivation read https://academic.oup...9/3/953/1094940
We can calculate the path approximately if we have a a starting point where r and phi are known. The only point we have is the point closest to the black hole. Unfortunaltely, dr / df is zero at this point. So I start a slightly larger radius (1e-8) hoping that the angle needed to reach this small deviation is also small. If you experiment with the program you’ll find that it is not clearly true in the near of the limiting q, where the light ray escapes scarcely.
To program first expects the input of q. The in follows the photon backwards until r>10. The program gives two values in the first line: the radius and the distance of the actual path form the center of the black hole. I calculate this because it is known that light rays from infinity need to have an initial distance of 2.6 to escape the black hole. You see that the more you lower q and the closer you come to the limiting q the more this value comes close to 2.6. The limit is around q=1.5, when the photon surrounds the black hole several times before it escapes.
This initial distance uses the formula for the distance of a point from a line. I use the parameter form of the line equation. This calculation is done after the NEXT command for the loop. The loop itself prevents to sketch every point.
The path is symmetric. I calculate only one direction.

 

If you choose a q to low for the light to escape, the program finishes with a r of 9999.

If you are interested I explain something more about the numerics in the program. It is not very complicated.


Edited by piu58, 30 May 2019 - 05:12 PM.


#213 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 29 May 2019 - 02:24 PM

My Prizm is here (CG20). I installed the OS 3.10 at first. After that, I installed C.Basic by copying it to the main folder via USB. I copied the @Font too.

 

After reorganizing the memory, the last item in the menu is C.Basic (called 

System ERROR

REBOOT: EXIT

INITIALIZE: EXE

TLB ERROR

TARGET=00010000

PC=0028800

 

EXE does not work. I may choose exit or Menu and go to another point.

 

Do you know what is wrong?



#214 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 29 May 2019 - 05:56 PM

Dear Sentaro,

 

now everything works.

 

We programmer need the ability to "guess" where the error may be. I thought it might be the overclocking. So I experimented with it. I load a program which lets me overclock the claculator and played around with it. At the end, I set it back to 58 Mhz. I don't believe that the pre owner played with such thing so I don't believe that was the reason for the "heailing".

 

The I looked for the very first version of C.Basic for this calculator. This was v53. The version asks whether to overclock or no. I answered "No" and the C.Basic run. I was happy! At least one version! I started again with overclocking. This worked to.

The I downloaded all of the version ant tested which one work. All do. Even v86 which gave the system error first-

 

So I think the v53 makes sets an internal variable which is connected to overclocking. This variabel cannot be set from the newer versions but is read. This is just my guess of course.

 

I tried my black hole program with the new calculator. I added '#SketchThin and it look very nice. X and Y take more room at the screen so Y overwrites X. I look for a solution to this which works with both calculators. 

 

What I very like is the much better display: For the program output, and, even more important, for editing programs. I  use the miniminifont in bold.



#215 Krtyski

Krtyski

    Casio Freak

  • Members
  • PipPipPipPip
  • 132 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
    fx-9860GIII
    fx-9750GIII
    fx-7400GIII

Posted 30 May 2019 - 02:34 AM

Hi piu58

 

My Prizm is here (CG20). I installed the OS 3.10 at first. After that, I installed C.Basic by copying it to the main folder via USB. I copied the @Font too.

 

After reorganizing the memory, the last item in the menu is C.Basic (called 

System ERROR

REBOOT: EXIT

INITIALIZE: EXE

TLB ERROR

TARGET=00010000

PC=0028800

 

EXE does not work. I may choose exit or Menu and go to another point.

 

Do you know what is wrong?

 

Let's say your CG20 is recognized as Drive E, root of E drive (E:) is "Storage Memory" of CG20, that is where C.Basic (CBCGxxx.g3a) should be copied. 

 

Also default place for program file for C.Basic for CG. With recent version of C.Basic, you can load files from "Main Memory" (E:\@MainMem\PROGRAM) and see them in File List of C.Basic. Then you can run them.

 

Program files for genuine Casio Basic should be copied to E:\@MainMem\PRGRAM, this is "Main Memory" of CG20.

 

Just for sure, please check very bottom of following page;

https://egadget2.web...ml#Installation

 

I hope this helps.

 

Good luck


Edited by Krtyski, 30 May 2019 - 03:08 AM.


#216 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 30 May 2019 - 04:37 AM

Dear Krtyski, I found your instruction yesterday and followed it. As you might read in my second entry: All works now. I think the problem is somewhere with overclocking. But I may be incorrect.



#217 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 30 May 2019 - 04:40 AM

@piu58
Congratulations on getting CG20 :D
And sorry for the system error. :bow:
 
According to the survey,
A system error occurred because the save buffer for the confirmation of startup overclocking at startup was not initialized. :banghead:
The overclocking itself was irrelevant.
 
So,
Here is new updated. :D
 
0.86 alpha for CG10/20/50/Graph90+E version.
       -Fixed the fatal bug that caused a system error when startup overclocking is required for CG10/20.
         This was enbug 0.85 (-Fixed the bug that caused a system error due to lack of stack in pop-up display.)
 
        -Changed specification that move to the "~*.*" file name when pressing the [.]Key of the file list.
        -Changed specification that move to the top of the folder list when pressing the [EXP(x10)]Key of the file list.
        -Fixed the bug that the status area was displayed by ? command in full screen mode.
 
1.99.5 beta for 9860G/9860GII series.
        -Changed specification that move to the "~*.*" file name when pressing the [.]Key of the file list.
        -Changed specification that move to the top of the folder list when pressing the [EXP(x10)]Key of the file list.
 
 
I tried your black hole program.
It makes a very interesting move that q is from 1.5. :D
It seems to be off the orbit.
 
Since CG series takes time to transfer LCD,
Do this to get it a little faster. ^_^
'Print.XY
Lbl P
Text 1,9,"                     ":
Text 1,9,X:
Text 1,79,Y;
Return 
Colon":" at the end of the command is to suppress data transfer to LCD.
Semicolons";" instead is to force data transfer to LCD at the timing of LCD refresh.
(Corrected English by Krtyski)
 
 
@Krtyski
Thanks for quickly help.  ^_^

Edited by sentaro21, 30 May 2019 - 06:35 AM.


#218 Krtyski

Krtyski

    Casio Freak

  • Members
  • PipPipPipPip
  • 132 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
    fx-9860GIII
    fx-9750GIII
    fx-7400GIII

Posted 30 May 2019 - 06:22 AM

Dear piu58

 

Dear Krtyski, I found your instruction yesterday and followed it. As you might read in my second entry: All works now. I think the problem is somewhere with overclocking. But I may be incorrect.

 

My comment actually did not help you, sorry.

But very quick update by sentaro21 seems good to solve the system error.



#219 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 30 May 2019 - 07:21 AM

Dear Sentaro, unfortunatley your last version contains another error. Some of the commands are shown with funny japanese signs. The program runs but are hard to read for us continental people :). The screen shot is taken from the black hole program.

 

jap.jpg



#220 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 30 May 2019 - 07:40 AM

There seems to miss the text format for some of the commands, like CoordOff.



#221 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 30 May 2019 - 09:59 AM

"Edit GB Font" of setup may have been set to Full.
Please set it Off. :)


#222 Krtyski

Krtyski

    Casio Freak

  • Members
  • PipPipPipPip
  • 132 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
    fx-9860GIII
    fx-9750GIII
    fx-7400GIII

Posted 30 May 2019 - 10:14 AM

Dear piu58

 

I know one possibility of the weird characters, so can you try following setting?

 

Run C.Basic for CG, then press Shift - MENU to go to SETUP page. Find an item "Edit GB Font". If it's "on" or "Full", please change this setting Off.

 

GB font is for Chinese. Many of those characters were simplified. But Japanese still use complex characters. Some of GB fonts can be used to express in Japanese. Casio is Japanese company but no Japanese font has been installed, sigh...

 

This is why we try utilizing GB font for Japanese expression.

 

 

Dear Sentaro, unfortunatley your last version contains another error. Some of the commands are shown with funny japanese signs. The program runs but are hard to read for us continental people :). The screen shot is taken from the black hole program.

 

jap.jpg


Edited by Krtyski, 31 May 2019 - 02:18 AM.


#223 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 30 May 2019 - 02:22 PM

Thank you both! Yes, I played with the setup which has more points as in the 9860 version.

~

In the next day I write a different version of the block hole program. This version calculates ray which fall into the black hole. This time I make it the other way around - first programming with the cg20 and then checki if it works with the fx-9860 too.



#224 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 31 May 2019 - 08:23 AM

Dear Casionauts,

 

I modified my light ray program so it can now calculate light rays falling in the event horizont. The starting point is not some "closest point" q anymore, but a point at de event horizont. The secon parameter I need is how steep the photon in the black hole falls. You have to give the tangens of the angle the light ray has at the Schwarzschild radius. 0 means it falls directly into the black hole, the highest value possible is in the near of 2.6 . There don't exist a light path which leads to shallower angle. If you try this you get the 9999 error.
You get a 7777 error if you try to use an angle too steep. The steepest I support is 0.03. I get numerical problems beyond that.
 
If you follow the photon please keep in mind: It moves always with the same velocity of c. If it seems to move slowly this is because parts of its path lead in the dimension the space is bended. This graph
 

rubber2.jpg

may give you an idea of that.

I did not know that the distance between the center of the black hole and the parameter t is the same. As you might remember form my last program, a value of 2.6 is the limiting one: If it comes from beyond this parameter it moves around the black hole a few times but escapes. If it is below, it enters.

 

For large values of t (let's say t=1) the calculation conforms very well. For low values there is a deviation. It comes from the large steps during the calculation. You may reduce the step size d form 0.001 to same smaller values (say 1e-4) to see that it gets more accurate. If you use this value for large t values, the simulation get very slow.

 

'ProgramMode:RUN
'photon in bended space
"t"?->t
Gosub G
If t<0.03:Then :7777->X:Gosub P:Goto S:IfEnd
Gosub c
1->r
0->f
1Exp(-)3->d
Do
 For 1->j To 10
  rrrr/tt->z
  z-r(r-1)->z
  If z<=0:Then :9999->X:Gosub P:Goto S:IfEnd
  Sqrtz->e
  r->R:f->F
  r+ed->r
  f+d->f
 Next
 rsin f->x:rcos f->y
 x-Rsin F->a:y-Rcos F->b
 Sqrt(aa+bb)->A
 (ay-bx)/A->Y
 r->X:Gosub P
 Plot rsin f,rcos f
 LpWhile r<10
Goto S
Stop


'circle
Lbl c
For 0->i To 2pi Step 0.1
 Plot sin i,cos i
Next
Return 
'Init
Lbl G
ClrGraph:CoordOff:AxesOff:GridOff:LabelOff:S-L-Normal:Rad:'#_SketchThin _
'_AxesOn_
ViewWindow (-)10,10,1,(-)5,5,1
Return 
'Print.XY
Lbl P
Text 1,9,"                                                                                    ":
Text 1,9,X:'9860-6,CG-9
Text 1,190,Y'9860-68,CG-180
Return 
Lbl S
Plot :Text 1,1,">"Disps

The program in this form run at my Prizm. It runs at the fx-9860 too, but you have to adapt the Text coordinates. The values you have to choose are in the comment. 


Edited by piu58, 31 May 2019 - 08:34 AM.


#225 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 31 May 2019 - 12:28 PM

@Krtyski
Thanks for the deep and detailed explanation! :D
 
@piu58
Thanks for the new version. :D
I tried playing it.
Is it correct to appear to escape from the black hole?
If t parameter is increases, it stops at 9999 error.
The following code has been changed to suppress the 9999 error.
  If z<=0:Then :9999->X:Gosub P:Goto S:IfEnd
  Sqrtz->e
  SqrtAbs z->e
Is that good? :rolleyes:

Edited by sentaro21, 31 May 2019 - 12:35 PM.


#226 Krtyski

Krtyski

    Casio Freak

  • Members
  • PipPipPipPip
  • 132 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
    fx-9860GIII
    fx-9750GIII
    fx-7400GIII

Posted 31 May 2019 - 01:39 PM

Dear piu58, sentaro21

 

The updated program for CG20 is interesting.

I think the plots going to past, in other words reality is that the photon is coming closely to black hole from the end position and being pulled into black hole.

 

Is this correct?



#227 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 31 May 2019 - 02:57 PM

Thank you for the interest in my program. Probably I explained the background not deep enough.

 

This second version is not a "new version" in closer sense. It describes a different situation. Both versions are valid.

The first one describes the case when a photon comes close to a black hole but escapes. The second one describes the situation if the photon cannot escape but fall into the black hole.

In both cases I have to calculate "backwards", as Krtyski mentioned. The light path of an incoming photon is the other way. Nevertheless, every light path is reversible: If we would release  a photon at the place near the black hole and with the direction you see it would escape from  the near place the way the program calculates. But the other way is more descriptive.

 

From the physical point of view it is not meaningful to suppress the 9999 error. The program calculates something then, but that is no real light path.If you get the 9999 error you selected starting conditions which cannot occur in nature.

 

In the first program: The closest point an escaping photon can come is 1.5 r_s. If you enter 1.5 in the program the photon escapes numerical. This is because the numerical approach. In reality it would move at r=1.5 forever. The photon needs to be some small amount more away.

 

The second program: If a photon hits the black hole, then the tangens of the angle has to be between 0 (direct infall) and 2.6  The last one occurs it the photon follows a way at which it would be just caught .  Seen from infinity, it is directed to a point just below 2.6 Schwarzschild radii atop the center of the black hole (the second number at top of the screen). It enters the black hole with an angle (tangens of it) with the same value: just below 2.6 . If it would point slightly more atop it would escape. So an entry angle of more then 2.6 (again, tangens of it) is not possible.
I would give a first explanation. I make some sketches of the situation in the next day and show it here.


Edited by piu58, 01 June 2019 - 05:59 AM.


#228 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 31 May 2019 - 06:21 PM

I made an image which explains the things more clearly:

SL1klein.jpg

 

All ray which come from above of 2,6 Schwarzschild radii will bend, but escape form the black hole. An ray exactly at 2,6 Schwarzschild radii (the correct value is 1.5 sqrt(3) ) neither escape nor reach the black hole. They surround the b.h. at 1.5 Schwarzschild radii forever. Rays close to this surround the hole a few times and then escape or enter.


Edited by piu58, 01 June 2019 - 06:00 AM.


#229 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 31 May 2019 - 06:32 PM

Case 1 will be simulated by the first program (escaping), case 2 by the second (entering). They use different formulae, more exact: The same formula but a different integration constant.

Unfortunately, I don't know where the ray hits the b.h. in advance. And I don't know in case 1 where the point of closest approach (parameter q) will be reached. That is the reason why the rays enter the image plane from 'somewhere'.

 

I modified my second program slightly. It calculates (and draws) twice. After the first calculation it knows where the ray enters the black hole. I store this angle (variable g) and take it  into account the second time and the ray looks like at my sketch.

 

Beside this I sketched a bar 2,5 Schwarzschild radii long for the second time. All rays should "hit" this bar at the point which is equal to the tangens of the entering angle (parameter t). The value is the one in the right corner of the screen. At values of t close to 2.6 the ray misses the bar slightly, but the calculated value says it shouldn't. Perhaps this has to to with rounding to the next 3x3 pixel for the thick line.


'ProgramMode:RUN
'photon in bended space
"t"?->t
Gosub G
If t<0.03:Then :7777->X:Gosub P:Goto S:IfEnd
0->g
1Exp(-)3->d
For 1->k To 2
 ClrGraph
 k>1.1=>F-Line 6,0,6,1.5Sqrt3
 Gosub c
 0->f
 1->r
 Do
  For 1->j To 10
   rrrr/tt->z
   z-r(r-1)->z
   If z<=0:Then :9999->X:Gosub P:Goto S:IfEnd
   Sqrtz->e
   r->R:f->F
   r+ed->r
   f+d->f
  Next
  rsin f->x:rcos f->y
  x-Rsin F->a:y-Rcos F->b
  Sqrt(aa+bb)->A
  (ay-bx)/A->Y
  r->X:
  Gosub P
  Plot rsin (f-g),rcos (f-g)
 LpWhile r<10
 Pol(b,a)
 List Ans[2]-pi/2->g
Next
Goto S
Stop


'circle
Lbl c
For 0->i To 2pi Step 0.1
 Plot sin i,cos i
Next
Return 
'Init
Lbl G
ClrGraph:CoordOff:AxesOff:GridOff:LabelOff:S-L-Normal:Rad:'#_SketchThin _
'_AxesOn_
ViewWindow (-)10,10,1,(-)5,5,1
Return 
'Print.XY
Lbl P
Text 1,9,"                                                                                    ":
Text 1,9,X:'9860-6,CG-9
Text 1,190,Y'9860-68,CG-180
Return 
Lbl S
Plot :Text 1,1,">"Disps

The new program shows the things more clearly at the screen, but the algebra is less clear. It is veiled by the computational tricks I needed to produce a decent screen view.


Edited by piu58, 01 June 2019 - 06:07 AM.


#230 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 June 2019 - 09:07 AM

@Krtyski
@piu58
Thanks very much. :D
I understand a little now.
If the input value is 1.5sqrt3, it works as expected.
If Print.XY is omitted, it will speed up considerably.
This is interesting. ^_^


#231 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 June 2019 - 07:50 AM

A bug was found. :bow:
Here is mew updated. ^_^
 
1.99.6 beta for 9860G/9860GII series.
-Fixed the drawing bug of Graph(X,Y) with argument of TTheta variable.(fixed enbug.)
-Fixed the bug that Getkey1 command freeze on SH3.
 
0.86 alpha for CG10/20/50/Graph90+E version.
-Fixed the drawing bug of Graph(X,Y) with argument of TTheta variable.(fixed enbug.)


#232 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 11 June 2019 - 04:00 AM

In the meantime I have three calculators. I updated all of them.



#233 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 June 2019 - 06:07 AM

@piu58
Thanks very much always. :D
 
 
Here are new updated version.  ^_^
 
2.00 beta for 9860G/9860GII series.
 
1.00 beta for CG10/20/50/Graph90+E.
 
        -Added the exception handling commands Try-Except-TryEnd and eliminated IsError().
        (Format) Try <program>
                 Except error code 1
                  <Processing for error1>
                 Except error code 2
                  <Processing for error2>
                 TryEnd
        If there is no error in <program>, processing moves after TryEnd.
        If error1 occurs, processing will move after TryEnd after executing <Process for error1>.
        If error2 occurs, processing will move after TryEnd after executing <Process for error2>.
        When Error3 occurs, an error pop-up appears because there is no corresponding Except.
 
        (Format) Except
        If there is no Except corresponding to an error, "Error" is executed because Except with no argument corresponds to all errors.
 
        (Example) Try 3*4+
                  Except 1
                   "Syntax Error"
                  TryEnd
        "Syntax Error" is executed, since SyntaxError error code is 1.
 
        (Example) Try 3*4/0
                  Except 1
                   "Syntax Error"
                  Except 40
                   "Divide by Zero"
                  TryEnd
        “Divide by Zero”is executed, since division by zero error code is 40.
 
        (Example) Try 3*4/0
                  Except 1
                   "Syntax Error"
                  Except
                   "Error"
                  TryEnd
        If there is no Except corresponding to an error, "Error" is executed because Except with no argument corresponds to all errors.
 
        The sample program is in CBasic_sample/Try_Except.
        Refer to ErrorCode_List.txt for the error code.
 
 
        -Fixed the bug of conversion to text where the CR was omitted even if a code from 0x01 to 0x2F other than 0x0C (Disps).


#234 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 15 June 2019 - 06:50 AM

v1.00 for CG! Congratulation.



#235 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 June 2019 - 11:35 AM

v1.00 for CG! Congratulation.

Thanks very much! :D



#236 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 17 June 2019 - 07:55 AM

Dear C.Basic enthusiasts,

 

just for fun I programmed a bifurcation diagram. This describes what happens with a population with increasing reproduction rate. Some mor can be read in Wikipedia

https://en.wikipedia...rcation_diagram

 

The program runs at the CG and at the fx series with a small change (commented). CG is more enicely of course.

 

You may change the program so it calculates small section of the image which show more and increasing detail. Beside of the init of the graphics and the range of the i loops you should increase the value "200" if you go more into depth.

 

Enjoy!

Gosub G
For 2.5->b To 4 Step (4-2.5)/384' fx: /128 ::  CG: /384
 Ran#->x
 For 1->i To 200
  bx(1-x)->x
 Next
 For 1->i To 200
  bx(1-x)->x
  Plot b,x
 Next
Next
Goto S
'Init
Lbl G
ClrGraph:CoordOff:AxesOff:GridOff:LabelOff:S-L-Normal:Rad:'#_SketchThin _
'_AxesOn_
ViewWindow 2.5,4,1,0,1,1
Return 
'Print.XY
Lbl P
Text 1,9,"                                                                                    ":
Text 1,9,X:
Text 1,180,Y'9860-72,CG-180
Return 
Lbl S
Plot :Text 1,1,">"Disps

Edited by piu58, 17 June 2019 - 08:00 AM.

  • pan.gejt likes this

#237 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 18 June 2019 - 12:39 AM

Thanks!
It is very interesting. :D
I prefer to have interesting images even though it is a simple programs.
This kind of program is suitable for CG series. :)
 
This is about 2x speed with a few optimization. ^_^
Gosub G
For 2.5->b To 4 Step (4-2.5)/384' fx: /128 ::  CG: /384
 Ran#->x
 For 1->i To 200
  (b*x)*(1-x)->x ' It is fast to calculate only two terms.
 Next
 For 1->i To 200
  (b*x)*(1-x)->x ' 
  Plot b,x: ' Suppress drawing
 Next
 PutDispDD ' Transfer to the LCD
Next
Goto S
'Init
Lbl G
ClrGraph:CoordOff:AxesOff:GridOff:LabelOff:S-L-Normal:Rad:'#_SketchThin _
'_AxesOn_
ViewWindow 2.5,4,1,0,1,1
Return 
'Print.XY
Lbl P
Text 1,9,"                                                                                    ":
Text 1,9,X:
Text 1,180,Y'9860-72,CG-180
Return 
Lbl S
Plot :Text 1,1,">"Disps
 

  • pan.gejt likes this

#238 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 18 June 2019 - 04:05 AM

Dear Sentaro and all,

 

I understand that the program works faster with suppressed graphics output (by the colon).

 

Beside this, you rplaced my 

  bx(1-x)->x

by 

(b*x)*(1-x)->x ' 

I tried it out, and the second version is around 20% faster. Can you explain this? I thought the computer calculates the same, first b*y and then this multiplied with 1-x.

 

I tried the same thing in Casio.Basic, there is no difference.


Edited by piu58, 18 June 2019 - 04:24 AM.


#239 sentaro21

sentaro21

    Casio Technician

  • Members
  • PipPipPipPipPipPip
  • 369 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 18 June 2019 - 07:21 AM

(b*x)*(1-x)->x ' 

I tried it out, and the second version is around 20% faster. Can you explain this? I thought the computer calculates the same, first b*y and then this multiplied with 1-x.

 

I tried the same thing in Casio.Basic, there is no difference.


Because C.Basic is an interpreter, prioritized evaluation of formula expression takes time.
C.Basic has a built-in mechanism to speed up calculations of binary operation as a method to further accelerate evalution of expression.
So simple binary arithmetic using parentheses is fast.
(It is equivalent compared to the precompiled language.)
I recommend using this trick if you want the program to run more faster. ^_^
 

Binary arithmetic can be done also this way.

b*(x*(1-x))->x

 


Edited by sentaro21, 18 June 2019 - 07:22 AM.


#240 piu58

piu58

    Casio Freak

  • Members
  • PipPipPipPip
  • 147 posts
  • Gender:Male

  • Calculators:
    Casio Graph 90+E, Casio fx-CG20

Posted 18 June 2019 - 10:18 AM

Thank you for that explanation. In my younger years I programmed a formula interpreter by myself, and I know the problem of formula evaluation. This was the reason for using revers Polish notation for my program :)





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