Edited by sentaro21, 07 May 2019 - 06:59 AM.
#201
Posted 04 May 2019 - 09:19 AM
#202
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
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:
#204
Posted 14 May 2019 - 12:35 PM
Hi piu58
Thanks very much for bug report.
#205
Posted 14 May 2019 - 01:06 PM
#206
Posted 15 May 2019 - 04:32 AM
That was fast! I replaced the version in both of my calculators. Looks fine now.
#207
Posted 16 May 2019 - 04:27 AM
That was fast! I replaced the version in both of my calculators. Looks fine now.
Edited by sentaro21, 19 May 2019 - 12:29 AM.
#208
Posted 26 May 2019 - 12:29 PM
#209
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
Posted 28 May 2019 - 07:14 AM
I am interested in such program. I am looking forward to have it in my calc. :-)
#211
Posted 29 May 2019 - 12:55 AM
SketchThin Plot
'#SketchThin
#212
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
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:
INITIALIZE:
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
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
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:
INITIALIZE:
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
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
Posted 30 May 2019 - 04:40 AM
'Print.XY Lbl P Text 1,9," ": Text 1,9,X: Text 1,79,Y; Return
Edited by sentaro21, 30 May 2019 - 06:35 AM.
#218
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
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.
#220
Posted 30 May 2019 - 07:40 AM
There seems to miss the text format for some of the commands, like CoordOff.
#221
Posted 30 May 2019 - 09:59 AM
#222
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 - 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.
Edited by Krtyski, 31 May 2019 - 02:18 AM.
#223
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
Posted 31 May 2019 - 08:23 AM
Dear Casionauts,
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
Posted 31 May 2019 - 12:28 PM
If z<=0:Then :9999->X:Gosub P:Goto S:IfEnd Sqrtz->e
SqrtAbs z->e
Edited by sentaro21, 31 May 2019 - 12:35 PM.
#226
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
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
Posted 31 May 2019 - 06:21 PM
I made an image which explains the things more clearly:
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
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
Posted 01 June 2019 - 09:07 AM
#231
Posted 08 June 2019 - 07:50 AM
#232
Posted 11 June 2019 - 04:00 AM
In the meantime I have three calculators. I updated all of them.
#233
Posted 15 June 2019 - 06:07 AM
#234
Posted 15 June 2019 - 06:50 AM
v1.00 for CG! Congratulation.
#235
Posted 15 June 2019 - 11:35 AM
v1.00 for CG! Congratulation.
Thanks very much!
#236
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
Posted 18 June 2019 - 12:39 AM
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
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
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.
Binary arithmetic can be done also this way.
b*(x*(1-x))->x
Edited by sentaro21, 18 June 2019 - 07:22 AM.
#240
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
General →
Your Projects →
Inside Casio Basic is now to be preparedStarted by Krtyski , 02 Dec 2016 Casio Basic C.Basic |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users