Jump to content



Photo
* * * * * 3 votes

C.Basic - International Release

Casio Basic C.Basic

  • Please log in to reply
105 replies to this topic

#81 sentaro21

sentaro21

    Casio Addict

  • Members
  • PipPipPip
  • 54 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 December 2017 - 12:03 PM

Hi piu58,
Thanks very much for interesting Conway life. :D
 
 
About variable as integer,
It is thought that % position is reverse.
i% is a correct.
% is a time variable same as Ticks when use it alone.
 
 
About the Locate error,
I think that it is not displayed at the balance of the refresh rate.
Please try the following option
 
Locate 1,2,"     ":
       ^
The screen is not refreshed when add a colon after a command.
 
 
 
Hi,Krtyski
Thanks very much always. :D
 
 
Here is the new version.
-mini editor performance up.
-error check the control variable of For - Next strong.
-Fixed cursor moving error for clip&paste.
 
-added PopUpWin( option. and it became the command with a return value..
(usage) PopUpWin( n )
(usage) PopUpWin( 11, "1st message string"[,"2nd message string"] )
 return value is always 1.
 and return to a previous screen after the command. 
(usage) PopUpWin( 10, "message string"[,"2nd message string"]  )
 when yes that return value is 1.
 when no  that return value is 0.
 and return to a previous screen after the command. 
 
-added FkeyMeu( option.
(example) FkeyMenu(1,42)
 display system icon (white "edit") at F1 position.
 
-to controled [EXIT[F1}EXE] key repeat.
-push left and right key moved top or botom in setup mode.
-Fixed not compatible for comment.
-Fixed extended ? command bugs.

Edited by sentaro21, 10 December 2017 - 12:05 PM.


#82 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 10 December 2017 - 12:49 PM

Thank your for your answer. I tried it out:

 

Locate 1,2,"     ": 

works.

 

i% is a correct.

works too. The empty loop runs much much faster.

 

To give you and the community something back: I simulated the combination of diffusion and convection in a small ducht. It is a refrence case for a real fluid simulation with mass transfer.

Some of the variables:

Mc field of concentrations

D diffusion coefficient

c concentration at the border

v free stream velocity

u velocity in the boundary layer

t time step

T total time

n number of layers

m number of columns

x size of an element of Mc in flow direction

y size of an element of Mc in diffusion direction

~

l leftward concentration before correction

 

Set the number of time steps in the k loop (or replace it by an input).

 

'diffusion layer

'init
10->n
100->m
{m,n}->Dim Mat c
1\exp(-)8->D
1000->c
1\exp(-)4->y
1\exp(-)3->t
0->T
0.1->v
1\exp(-)3->x
For 1->k To 100
'one time step
Locate 1,2,"     ":
Locate 1,2,k
'boundary conditions
For 1->j To n:0->Mat c[1,j]:Next
For 1->i To m:c->Mat c[i,1]:Next
'diffusion
For 1->i To m
 For 2->j To n
  Mat c[i,j]-Mat c[i,j-1]->d
  If d>0.5c:Then "d#E692"_
  IfEnd
  Mat c[i,j]-Ddt/yy->Mat c[i,j]
 Next
Next
'followed by convektion
For 2->j To n
 Mat c[i,j]->l
 For 1->i To m
  jv/n->u
  ut/x->d
  If d>0.5:Then "d#E692"_
  IfEnd
  Mat c[i,j]->s
  (1-d)Mat c[i,j]+dl->Mat c[i,j]
  s->l
 Next
Next
T+t->T

Next

 

Inspect Mc after the run.


Edited by piu58, 10 December 2017 - 01:17 PM.


#83 sentaro21

sentaro21

    Casio Addict

  • Members
  • PipPipPip
  • 54 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 December 2017 - 02:10 PM

Hi piu58
It was good to works well. :D
Thakns very much for the interesting program again.
I think that it becomes a good reference program of C.Basic with Conway life. :D


#84 Krtyski

Krtyski

    Casio Addict

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

  • Calculators:
    FX-502P, FX-602P, fx-603P,
    fx-4500P, fx-5800P,
    fx-9860GII-2(SH4A),
    fx-9860GII SD,
    fx-CG20,
    fx-CG50

Posted 11 December 2017 - 01:11 PM

Hi sentaro21 and piu58

 

I'm so interested in the new feature of FKeyMenu( commamnd that allow us to directly set number of system function icon as 2nd parameter.

 

In order to know the icon and its number, I made System Function Icon Scanner; SysFunc.g1m.

I think this program should work on fx-9860G at this time.



#85 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 13 December 2017 - 06:26 PM

Eventual I printed the manual and experimented with the new features. My fx-9860 did not have String operations - until now! Very great.

Strings are stored in matrices. What I don't understand: Why are the sprintf results stored in numbered Strings? How can I convert these?

 

I also love that I can store matrices as files. These matrices can be transferred to a PC. I would like to have a description of the binary layout of the float numbers. I could then write a small C routine which extracts this to a text file and vice versa. Therewith I could calculated something at the fx and later use it in a program at the PC.



#86 sentaro21

sentaro21

    Casio Addict

  • Members
  • PipPipPip
  • 54 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 December 2017 - 11:32 AM

Hi,Krtyski
Thanks very much for useful program. :D
 
 
 
Hi piu58
Thanks very much for using C.Basic a lot. :D
 
Sprintf just uses the library function of C.
The operands are necessary to specify the type of number (% or #)
The result of sprintf becomes the character string.
 
(example)
 "Hello"->Str 1
 Sprintf("Strings=%s",Str 1 )->Str 2
 
Result of Str 2 is "Strings=Hello"
 
 
When appoint numerical value,
(example)
 123.456->A
 Sprintf("Double=%f",#A )->Str 2
 
Result of Str 2 is "Double=123.456"
 
(example)
 123.456->A
 789->B
 Sprintf("Double=%f Int=%d",#A,%B )->Str 2
 
Result of Str 2 is "Double=123.456 Int=789"
 
 
 
 
Hore is new updateed. :)
 
-Fixed the initialization bug in the case of continuation space for string to Mat.
(example) ["     ","12345"]->Mat A
 
-Added function that change the selection area to the comment in CLIP&PASTE.
Shift-8(CLIP)  F5orF6
 
-Added new founction of BmpLoad( that to be able to load data directly on VRAM.
(example) BmpLoad("TEST"),20,10
 load TEST.bmp at coordinate (20,10).
 
-Added new founction of BmpSave that to be able to save data directly from VRAM.
(example) BmpSave "TEST",10,20,100,50
 save TEST.bmp at coordinate (10,20)-(100,50)
 
-added FkeyMeu( option.
(usage) PopUpWin(0)
 Only screen evacuation does not perform PopUp.
(usage) PopUpWin(9)
 Only as for the return of the screen which evacuated.
 
-Added option "(" for List or Mat@
(example) 1->A
(example) List (A+1)
 = List 2
(example) Mat @(A+1)
 = Mat 2 = Mat B


#87 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 07 January 2018 - 08:23 PM

Dear Sentaro,

 

again I have a problem with screen refresh, this time with the graphics screen.

 

A few background: I am a hobby astronomer. From time to time I write a program, which is not particular useful, but helps to understand things. This time I experiment with projection of Maps (like Mercator projection). At the end I write a Python program for my friends. But for experimenting I love my calculator.

 

In the first step I wrote a program which has a few points in it which represent Greenland and Africa. In the Mercator projection they are of similar size, which doesn't reflect the reality. I want to show in the future, how different projections change this.

 

In the very first step I implemented the rectangular projection, which uses x for lambda and y for phi (the very simples projection at all).

 

I have the problem, that the last point is not plotted. I added an extra plot command (second last line after the next), then all points are given but this extra point is not given.

 

It is not a large problem, because it is always possible to set an extra point. But it is against my sense for aesthetics.

 

Is there a reason for that behavior?

 

The program:

'experiments with map projections
Deg
ClrGraph:CoordOff:AxesOff:GridOff:LabelOff
ViewWindow 0,126,0,0,62,0
'grenland and  afrika
{12,2}->Dim Mat c
'Greenland
(-)60->Mat c[0,0]:83.5->Mat c[0,1]
-25->Mat c[1,0]:83.5->Mat c[1,1]
-72->Mat c[2,0]:78->Mat c[2,1]
-20->Mat c[3,0]:70->Mat c[3,1]
-45->Mat c[4,0]:60->Mat c[4,1]
' Africa
-5->Mat c[5,0]:37.5->Mat c[5,1]
-17->Mat c[6,0]:20->Mat c[6,1]
-8->Mat c[7,0]:4->Mat c[7,1]
10->Mat c[8,0]:4->Mat c[8,1]
20->Mat c[9,0]:-35->Mat c[9,1]
41->Mat c[10,0]:-15->Mat c[10,1]
51->Mat c[11,0]:11->Mat c[11,1]
30->Mat c[12,0]:30->Mat c[12,1]
'quadratic projection
For 0->i To 12
 Mat c[i,0]->l
 Mat c[i,1]->f
 l->x
 f->y
 Plot 63+x/3,31+y/3
Next
Plot 1,1
Text 58,125,">"_


#88 sentaro21

sentaro21

    Casio Addict

  • Members
  • PipPipPip
  • 54 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 09 January 2018 - 08:00 AM

Hi piu58
 
C.Basic use the frame rate control method in the screen refresh.
It limits the number of the screen refresh of the second interval.
Locate or Text command is outside of control by default.
Other graphics commands are controled.
This is the cause that the last drawing was left.
 
If not worried about the decrease in execution speed,
Please turn it off by setup(RefrshCtr DD) to cancel this frame rate control. :)


#89 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 09 January 2018 - 08:18 AM

setup(RefrshCtr DD) to cancel this frame rate contro

 

I found it out by myself. Thank you for supporting my work.

 

I put here a complete world map in the next few day. In contradiction to other maps it contains real coordinates, which may be used to experiment with different mapping procedures.

 

BTW: Is there a way to read the dimensions of a matrix? I used the C.Basic replacement for DATA lines, which is direct assignment of a matrix with the [ [ ] [ ] ] command. Very cool! But it is cumbersome to count the amount of [] every time something is added.


Edited by piu58, 09 January 2018 - 08:19 AM.


#90 sentaro21

sentaro21

    Casio Addict

  • Members
  • PipPipPip
  • 54 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 January 2018 - 04:22 AM

BTW: Is there a way to read the dimensions of a matrix? I used the C.Basic replacement for DATA lines, which is direct assignment of a matrix with the [ [ ] [ ] ] command. Very cool! But it is cumbersome to count the amount of [] every time something is added.

Ok! :)
 
(example)
{2,3}->Dim Mat A
 
By the genuine command,
Dim Mat A
Result of List Ans -> {2,3}
 
 
By the C.Basic extended command,
OPTN-F2(MAT)-F6-F5(SIZE)
ColSize(A) -> 2
RowSize(A) -> 3

  • piu58 likes this

#91 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 10 January 2018 - 02:55 PM

Thank you for your answer. It works fine!

 

The error with the last point still exists. I tried to give the smallest program which it shows:

ClrGraph:CoordOff:AxesOff:GridOff:LabelOff
ViewWindow 0,126,0,0,62,0
Plot 10,10
'Plot 10,10
Text 58,125,">"_

I use the Text command to avoid the cursor around the last point. If I do this, the last point is not given. If you delete the ' before the second plot command, the first point comes.

~

If you want to play with my world map program,please download it. The goal of the program is the comparison of different map projections and the mathematics behind them.

 

Link to the program:

 

http://fg-kometen.vd...mp/KARTENWU.g1m

 

(@all: I delete this link after a few days. If someone is interested in that thing later, please mail me)


Edited by piu58, 10 January 2018 - 03:00 PM.


#92 sentaro21

sentaro21

    Casio Addict

  • Members
  • PipPipPip
  • 54 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 January 2018 - 02:16 AM

Thank you for your answer. It works fine!

 

The error with the last point still exists. I tried to give the smallest program which it shows:

ClrGraph:CoordOff:AxesOff:GridOff:LabelOff
ViewWindow 0,126,0,0,62,0
Plot 10,10
'Plot 10,10
Text 58,125,">"_

I use the Text command to avoid the cursor around the last point. If I do this, the last point is not given. If you delete the ' before the second plot command, the first point comes.

 

You probably wondered about that.
however,it is one of the mysterious specifications of genuine Casio Basic.
Because C.Basic is compatible with genuine Casio Basic,
C.Basic becomes the same specifications.
 
The solution of repeating PlotOn is to replace it with PxlOn from PlotOn.
In that case,the following setting is necessary to match a coordinate level of PxlOn with PlotOn.
ViewWindow 1,127,0,63,1,0
 
 
I downloaded your world map program. 
It is a very interesting program.
Thanks for the nice program! :D
 
 
 
Hore is new updated. :)
-Fixed can't input "StrLwr(" in standard mode method.
-Fixed Replace bugs for Editor.

 


Edited by sentaro21, 11 January 2018 - 02:42 AM.


#93 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 11 January 2018 - 07:47 AM

Thank you for that explanation. I stay with Plot, but add an extra Plot command to the Text line, which is necessary anyway.

 

I installed the new version, thank you for maintaining it.



#94 sentaro21

sentaro21

    Casio Addict

  • Members
  • PipPipPip
  • 54 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 January 2018 - 03:08 AM

Thank you for that explanation. I stay with Plot, but add an extra Plot command to the Text line, which is necessary anyway.

 

I installed the new version, thank you for maintaining it.

Thanks! :D
 
I'm developing C.Basic for CG10/20/50 version now.
A bug for FX is found in the process.
 
Because it's compatible with g1m of the FX version, 
Your program completely works in C.Basic for CG. 
I think that the high-resolution graphics matches your world map program very much. :D
If you are interested in CG series,
Please use C.Basic for CG.


#95 Krtyski

Krtyski

    Casio Addict

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

  • Calculators:
    FX-502P, FX-602P, fx-603P,
    fx-4500P, fx-5800P,
    fx-9860GII-2(SH4A),
    fx-9860GII SD,
    fx-CG20,
    fx-CG50

Posted 12 January 2018 - 07:40 AM

Hi, piu58

 

 

~

If you want to play with my world map program,please download it. The goal of the program is the comparison of different map projections and the mathematics behind them.

 

I did enjoy the world map. I also googled about math of different mapping.

Thank you for the interesting program.

 

 

At first I got an error (Dimension ERROR) and then I found Matrix base should be 0, not 1.

As my default setting, I set different matrix base. So I added '#Mat 0. This is just for others who try this program.



#96 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 13 January 2018 - 07:18 AM

Thank you for that hint. I use this setting because of the similarity to C, Java an so on. I did not know that the #Mat 0 command exists.

~

Some words to this program. I am hobby astronomers and try to explain my fellows physical or mathematical principles with the help of computer programs (in the end Python). Mapping is an area which is connected to astronomy.

The easiest way to map is to use lambda and phi as x any y (equirectangular). To come form this to an isogonal Mercator map you have to consider: Every circle of latitude is extended by a factor of (1/cos phi). To come to a map where everywhere 1 degree in longitude is exactly as large as one degree in latitude, you have to expand the (local) longitude by 1/cos phi too. The y value is the sum of all thes small extension, in fact an integral. The mathematical solution of this is

ln (tan phi +1/cos phi)

which you can fin in the program. In the end I comment this line out an replace it by a summation (numerical integration) of tiny 1/cos phi bits for educational purposes.

All the other maps are equal area ones. In this case you have to shorten the local longitude by cos phi, to remain the local area. The integral of cos is sin, which you may find in the map. All the equal area maps are equivalent by stretched in y direction to have the neutral zone at another latitude. In this zone longitude and latitude are equal and you don't have any distortions.

~

If you have an interest in other programs of similar complexity (which is low I think) please drop a line here. I upload it when ready and give a small explanation like this.

My goal is that the readers of my articles of our magazine experiment with the program and get a deeper understanding of what happens.

 

 

If you are interested in CG series,

 

Some years ago, when I bought (again) a programmable calculator (in fact two of them, one at home and one at work), I want to have something different of a computer. Especially  don't like a background lit screen. The most advanced one is the 9860, so I bought it.

 

FYI: I started programing with a pocket calculator. My first one was a russian BS-34  . It has only 98 programming steps and 14 memory registers which could be used as a list. Even with this I wrote a simple simulation program for heat transfer, which simulates thermal diffusion.

 

__________

 

after half a day: I implemented the numerical integration as a first projection. If you use any number beyond the ones in the menu it will be calculated. 

The difference between Lambert and Mercator is very small instead /cos(phi) *cos(phi) and some tweaking of the output size:

5=t=>Goto b
'num integration
For 0->i To z-1
 Mat c[i,0]->l
 Mat c[i,1]->f
 l->x
 1->s
 Abs f>1\exp(-)9=>f/Abs f->s
 1->y
 For 1->j To Abs f
  y+1*cos j->y'/cos->m, *cos->l
 Next
 ys->y
 Plot 63+x/3,31+y/3'/5->m,/3->l
Next
Goto e
Lbl q
'equirect
For 0->i To z-1

As you can see I have to take the signum into account. There is no sgn function in the fx, so I simulated it by x/Abs(x) (which requires that I exclude zero).

 

I replaced the program at the store place.


Edited by piu58, 13 January 2018 - 04:41 PM.


#97 Kfftfuftur

Kfftfuftur

    Newbie

  • Members
  • Pip
  • 7 posts
  • Gender:Male
  • Location:Germany

  • Calculators:
    Casio Fx 9860 GII

Posted 13 January 2018 - 09:06 PM

Hi,

is there any documentation what SysCall(), Call(), Poke(), and Peek() do?

Kfftfuftur



#98 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 13 January 2018 - 09:33 PM

I think three of them are quite clear:

Call calls a processor routine at a given address

Peek reads a memory place form the processors memory

poke writes an integer to a memory place



#99 Kfftfuftur

Kfftfuftur

    Newbie

  • Members
  • Pip
  • 7 posts
  • Gender:Male
  • Location:Germany

  • Calculators:
    Casio Fx 9860 GII

Posted 13 January 2018 - 09:45 PM

Call and Peek apear to work with one argument, but i havent managed to run Poke without a Syntax error. 

i am also unsure about wether they would take hexadecimal or decimal numbers as input



#100 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 13 January 2018 - 10:04 PM

I tried it out.

peek(1234)->a works but I had to reboot afterwards :banghead:

 

I assume you may use poke(address,content) where both are integers.



#101 sentaro21

sentaro21

    Casio Addict

  • Members
  • PipPipPip
  • 54 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 January 2018 - 02:12 AM

Hi piu58

 
I downloaded new world map program.
I 'm interested in astronomy from old days.
However, I'm not familiar in an astronomical calculating formula.
That is very useful for me.
Thank you very much! :D

Call and Peek apear to work with one argument, but i havent managed to run Poke without a Syntax error. 

i am also unsure about wether they would take hexadecimal or decimal numbers as input

Hi Kfftfuftur
 
SysCall(, Call(, Poke(,and Peek(
is described in the 1180th line of the Manual_EN.txt. :)
(I'm sorry that English translation is poor every time.)
hexadecimal or decimal numbers hex are possible in an argument.
Because these commands access hardware directly, please be careful.
 
(Poke examlpe 1)
'#CBDBL
VarPtr(A)->X
Poke(X).F,123.45
A
result of A is 123.45
 
(Poke examlpe 2)
'#CBDBL
VarPtr(A%)->X
Poke(X).L,12345
A%
result of A% is 12345
 
 
What kind of syntax does it become the error ?


#102 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 17 January 2018 - 02:38 PM

Dear Sentaro and all,

 

I have written another program which calculates the solar magnetic fieild. Explanation in the next entry,

'solar magnetic field
10->t
400->e
Deg
ClrGraph:CoordOff:AxesOff:GridOff:LabelOff
ViewWindow 0,126,0,0,62,0
0->T
'init
{2161,1}->Dim Mat m
'coordinates
For 0->i To 2160
 0->Mat m[i,0]
 90-i/12->f
 f->Mat m[i,1]
Next
Do
 'plot
 ClrGraph:CoordOff:AxesOff:GridOff:LabelOff
 ViewWindow 0,126,0,0,62,0
 Text 58,115,T
 For 0->i To 2160
  'modif lambert
  Mat m[i,0]->l
  Mat m[i,1]->f
  l->x
  57.3sin f->y
  Plot 63+x/3,31+y/2
 Next
 'calc
 For 1->j To t
  For 0->i To 2160
   'phi - differential rotation
   Mat m[i,1]->f
   90-Abs f->F'poldistanz
   1.124\exp(-)6FFF+2.583\exp(-)4FF+0.0188F->d'diff rot
   Mat m[i,0]+d->w
   w>180=>w-360->w
   w->Mat m[i,0]
   'lambda -  meridional flow
   Mat m[i,1]->l
   0->d
   Abs f<60=>0.142sin (f/3)->d
   f+d->Mat m[i,1]
   Next
   Next
 T+t->T
LpWhile T<e
Plot 125,5:Plot 125,5:Text 58,125,">":_


#103 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 17 January 2018 - 02:44 PM

The solar magnetic filed is coupled with plasma at the surface of the sun. The plasma rotates faster at the equator. So the field gets twisted.

Beside this, ther are a movement toward the poles, the meridional flow.

 

I approximated the differential rotation by a polynomial of degree 3 (calculated from tables I found) and the merdionale flow by a sine function.

I started wit a single magnetic line form nort to sout. I set so many points at this line I could, because I want that it remains a line even when twisted. This works for a while, but at the end you see single dots in the equator region. You need more memory for this.

 

The magnetic field gets denser and denser. My graph is a map which preserves area (Lambert type). The more black the display the stronger the magnetic field.

If the field gets too strong magnetic shortcuts evolve, which are visible in solar spots. This spots start at phi~35 degree, and destry the field here. The field gets stronger after that in lower latitudes and the spots move to here (butterfly diagram). This process cannot be simulated with this tiny program.

 

The first solar spots occur after one or two years. The program calculates until 400 days now (e), the graphic gets new after 10 simulated days (t). You may change this. You can calulated the latidude where the magentic lines are densest. Look at the screen and measure where it is from the middle of the screen (s). The you need the size of the half screen (h). The latidude of the first spots is

arcsin (s/d)

You have to use the arcsin because of the projection function of Lambert type maps.My result is around 45-50 degs, which is higher than real. But the effect can be seen in principle. Which ist the main goal of the program.

 

I used a lot of memory. It may be that you have to delete some stored programs and optimize the memory (Menu cos).


Edited by piu58, 17 January 2018 - 03:00 PM.


#104 sentaro21

sentaro21

    Casio Addict

  • Members
  • PipPipPip
  • 54 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 January 2018 - 09:56 AM

Hi piu58,
Thanks very much for new interesting program again. :D
 
There is few code becoming the converting error.
1.124\exp(-)6FFF+2.583\exp(-)4FF+0.0188F->d'diff rot
Is this correct?
1.124Exp(-)6FFF+2.583Exp(-)4FF+0.0188F->d'diff rot
 
This program execution took time, but I enjoyed detailed drawing with a value of t as 1 with Ftune2. :D
 
For measures to lack of the memory, I thnk that to reduce memory by changing matrices of the integer size. (. L or . W)
 
{2161,1} :->: Dim Mat m.L
f :x: 100 :->: Mat m[i,1]
Mat m[i,1] :/: 100 :->: f
 
 
Alternatively, if it is fx-9860GII You can use about 8 times the size of memory .


#105 piu58

piu58

    Casio Fan

  • Members
  • PipPip
  • 30 posts
  • Gender:Male

  • Calculators:
    Casio fx-9860G

Posted 18 January 2018 - 10:58 AM

The line you mentioned is

1.124e-6*F*F*F+2.583e-4*F*F+0.0188*F->d

I set all the multiplication signs here which I omitted in the real formula.

This is the polynomial of third degree which calculates the diffential rotation. F is the polar distance. So the value is alway 0 at the poles. It becomes around 4.6 (degrees per day)at the equator.

The  \exp comes from my transformation program which is casform_10.0 .

 

 to lack of the memory, 

 

Because the result is symmetric to the equator it is possible to calculate half of the area only. The graphics will be better too in this case.


Edited by piu58, 18 January 2018 - 11:01 AM.


#106 sentaro21

sentaro21

    Casio Addict

  • Members
  • PipPipPip
  • 54 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 January 2018 - 05:51 AM

The line you mentioned is

1.124e-6*F*F*F+2.583e-4*F*F+0.0188*F->d

I set all the multiplication signs here which I omitted in the real formula.

This is the polynomial of third degree which calculates the diffential rotation. F is the polar distance. So the value is alway 0 at the poles. It becomes around 4.6 (degrees per day)at the equator.

The  \exp comes from my transformation program which is casform_10.0 .

 

 to lack of the memory, 

 

Because the result is symmetric to the equator it is possible to calculate half of the area only. The graphics will be better too in this case.

Ok!

Thanks ! :D







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