The truth is, I am a pretty horrible programmer in some senses. I have had a whole lot of difficulty when it comes to learning a new programming language. My biggest hurdle, I think, is getting adjusted to the syntax and setting up the appropriate environments. I like to blame this on the fact that I started with TI-BASIC and my first few years of programming computer-less. Anyways, I finally managed to figure out how to setup Code::Blocks after having it on my computer for a year (one of my IRL friends wanted to learn C++ and we challenged each other). I also found some site that guided me step-by-step through setting up several things for programming in C++. I still have no clue what a .dll .lib or .a file does (though I think .a = .lib ?), but that hasn't been important.

My first two experiments were with fractals that I hadn't been able to explore in their glory on my calculator and I actually didn't get too many errors. Needless to say, I was happy and hopefully I will slowly learn C and C++ and make some headway into other programming languages and concepts. For now, my first few codes are embarrassing and inelegant, but I think the images are pretty enough Smile :

Imagine that on my calc, I could only see 96x64 pixels of this at any given time. Scaling didn't work because it missed most of the details:

I added color using some math:

Actual colors, not just grayscale:

The Mandelbrot set <3 I have a 12288x12288 pixel image one using a different color pattern:


I also made a Mandelbrot Explorer. You can see a video of it here. It is actually a bit faster and not as choppy, but the recording software cut into my CPU performance a bit (I have a 1.6 GHz processor).

EDIT: I fixed a few spelling and grammar issues. Plus, I forgot to mention that I made a 1-D cellular automata program that continually scrolls through a given ruleset.
This is beautiful work, Xeda. What compiler and/or IDE are you using? What graphics library and platform? What book(s)/tutorial(s) guided you along your journey? We have plenty of C/C++ coders here, so don't hesitate to ask if you have any questions.
Great work. Thanks for sharing those - just proves that maths is beautiful and not just numbers in a text book.
I am interested in learning C/C+ mainly as I am tinkering with a Casio 9750GII at the minute. The SDK supports C to build the "Add-In" programms which are the equivalent of Flash Apps on the TI. I have done a bit of PIC and so C/C+ could be within my abilities..

Let us know how you get on..
Thanks! I am using Code::Blocks currently and the SDL library. I am on a Windows 7 OS (64-bit) but the code should be compiled to work on 32-bit machines. I've basically just been bouncing around the internet whenever I run into a problem that I need to figure out. Like yesterday, I used Google to search "how do I define an array" so that I could supply a few prime numbers to my Riemann Zeta function (to help compute the values). I also had to use a Google search to figure out how to install the SDL library and I looked up a few examples for how to plot and read pixels. I have seen enough code that I had a basic knowledge of how to do If, For, and While statements, and the errors returned where informative enough that I figured out that I needed parentheses around conditions. I am also getting used to adding a semicolon to the end of each line. I had to look up variable types so that I could get the fractals to work nicely. I haven't really read through any tutorials yet, I just skimmed through the portions I needed.

Shmibs pointed me to this: http://programming-motherfucker.com/become.html#C / C++
So I will probably check that out, and this was super helpful in setting up SDL and providing examples for graphics: http://lazyfoo.net/SDL_tutorials/

@ti83head: Yes, math is so beautiful! I also want to make my Mandelbrot explorer for the Prizm. My first attempt doesn't work and I tried to make it several months ago with no idea of how to set things up. Hopefully, now that I have an outline of the program and an idea of what does work, I can make it.

I am excited !

EDIT: Also, for the Mandelbrot Set, I really wanted to test a coloring scheme that I had thought of and I am glad it worked precisely as I pictured it. I remembered a professor of mine using a system where the escape times were computed before hand, but I thought that it would be annoying to have to recalculate it based on the zoom every time, so I made this very simple code to color. As you can see, the results are fantastic:

Code:

    int a=Iter-MaxIter;
    color[0]=a % 64 * 4;
    color[1]=3*a % 64 * 4;
    color[2]=5*a % 64 * 4;

That is my favorite coloring scheme, but if you change the multiplying values to {1,11,5} you will get the colors above. Changing all of the multipliers to the same value will result in grayscale.
Thanks ! That info is useful.
Has anyone else used C / C+ with the Casio SDK ?
I just started to and I got the "Hello World!" program to work!
Can you share any links to tutorials for this ? The Casio site is very limited: although Casio Kingdom have some useful code snippets but are plagued with broken links....
This is what I am working from, currently:
http://prizm.cemetech.net/index.php/Prizm_Programming_Portal
http://www.cemetech.net/forum/viewtopic.php?t=6114

Although I cannot seem to draw a Mandelbrot set yet :[ I am not sure what is wrong with my code, so I will leave up my current code to see if anybody can point out the issue (it is only drawing a single color on the whole 200x200 region):


Code:

#include <fxcg/display.h>
#include <fxcg/keyboard.h>


void plot(int x0, int y0, int color) {
   char* VRAM = (char*)0xA8000000;
   VRAM += 2*(y0*LCD_WIDTH_PX + x0);
   *(VRAM++) = (color&0x0000FF00)>>8;
   *(VRAM++) = (color&0x000000FF);
   return;
}


int main() {
  Bdisp_AllCr_VRAM();
  double CxMin=-2.0;
  double CyMin=-1.5;
  double delta=3/200;
  double Zy2,Zx2,Zy,Zx,Cx,Cy;
  int x,y,iter,a,itermax=200;

  Cx=CxMin;
  for(x=0;x<200;x++)
  {
    Cy=CyMin;
    for(y=0;y<200;y++)
    {
      Zx=Cx;
      Zy=Cy;
      Zx2=Cx*Cx;
      Zy2=Cy*Cy;
      for(iter=0;(iter<itermax)&&((Zx2+Zy2)<=4);iter++)
      {
        Zy=Zx*Zy*2+Cy;
        Zx=Zx2-Zy2+Cx;
        Zx2=Zx*Zx;
        Zy2=Zy*Zy;
      }
      a=iter-itermax;
      if (a){a=-1;}
      plot(x,y,a);
      Cy+=delta;
    }
  Cx+=delta;
  Bdisp_PutDisp_DD();
  }

  int key;
  while(1)
  GetKey(&key);
  return 0;
}


EDIT: I got it to work, but I don't know what the major difference is. I am assuming order of operations stuff and that spaces are important in math? Or is it because I needed delta=3.0/200 ? : My new code:

Code:

#include <fxcg/display.h>
#include <fxcg/keyboard.h>
void plot(int x0, int y0, int color) {
   char* VRAM = (char*)0xA8000000;
   VRAM += 2*(y0*LCD_WIDTH_PX + x0);
   *(VRAM++) = (color&0x0000FF00)>>8;
   *(VRAM++) = (color&0x000000FF);
   return;
}
int main() {
  Bdisp_AllCr_VRAM();
  double CxMin=-2.0;
  double CyMin=-1.5;
  double delta=3.0/200;
  double Zy2,Zx2,Zy,Zx,Cx,Cy;
  int x,y,iter,a,itermax=200;
  Cx=CxMin;
  for(x=0;x<200;x++)
  {
    Cy=CyMin;
    for(y=0;y<200;y++)
    {
      Zx=Cx;
      Zy=Cy;
      Zx2=Cx*Cx;
      Zy2=Cy*Cy;
      for(iter=0;iter<itermax && ((Zx2+Zy2)<=4);iter++)
      {
        Zy=2*Zx*Zy +Cy;
        Zx=Zx2-Zy2 +Cx;
        Zx2=Zx*Zx;
        Zy2=Zy*Zy;
      }
      a=iter-itermax;
      if (a){a=-1;}
      plot(x,y,a);
      Cy+=delta;
    }
  Cx+=delta;
  Bdisp_PutDisp_DD();
  }

  int key;
  while(1)
  GetKey(&key);
  return 0;
}


EDIT2: And I got this to work on my Prizm:

Thanks to the help on IRC for getting the colors to stay out of reduced mode. Now I will want to make an explorer, but it is a pretty slow program as it is :/ The explorer only needs to compute a single row or column at a time, but zooming will require fully redrawing the image which will take a little while.

Code:

#include <fxcg/display.h>
#include <fxcg/keyboard.h>
void plot(int x0, int y0, int color) {
   char* VRAM = (char*)0xA8000000;
   VRAM += 2*(y0*LCD_WIDTH_PX + x0);
   *(VRAM++) = (color&0x0000FF00)>>8;
   *(VRAM++) = (color&0x000000FF);
   return;
}
int main() {
  Bdisp_AllCr_VRAM();
  Bdisp_EnableColor(1);
  double CxMin=-2.0;
  double CyMax=1.5;
  double delta=3.0/192;
  double Zy2,Zx2,Zy,Zx,Cx,Cy;
  int x,y,iter,a,itermax=50;
  Cx=CxMin;
  for(x=0;x<384;x++)
  {
    Cy=CyMax;
    for(y=0;y<192;y++)
    {
      Zx=Cx;
      Zy=Cy;
      Zx2=Cx*Cx;
      Zy2=Cy*Cy;
      for(iter=0;iter<itermax && ((Zx2+Zy2)<=4);iter++)
      {
        Zy=2*Zx*Zy +Cy;
        Zx=Zx2-Zy2 +Cx;
        Zx2=Zx*Zx;
        Zy2=Zy*Zy;
      }
      a=iter-itermax;
      a=2048*(a%32) + 32*(a % 64) + (a % 32);
      plot(x,y+32,a);
      Cy-=delta;
    }
  Cx+=delta;
  Bdisp_PutDisp_DD();
  }

  int key;
  while(1)
  GetKey(&key);
  return 0;
}
ti83head wrote:
Thanks ! That info is useful.
Has anyone else used C / C+ with the Casio SDK ?
I'd hope so, we created it. Razz

Xeda112358 wrote:
I am assuming order of operations stuff and that spaces are important in math? Or is it because I needed delta=3.0/200 ?
The latter. If you don't explicitly specify the type of your constants, they're assumed to be integers as long as there's no fractional part. Thus the integer division there always yields 0.
Clear spacing is recommended, but not required. The compiler has a set of operator precedence rules to determine the order in which operations will be performed, which are largely a superset of conventional order of operations.
@Tari - sorry for my ignorance ! Very Happy I have just found Kerm's thread for getting started with the SDK. I was forgetting about the Prizm...

What if I am coding for the 9860? Do I use the SDK from the Casio site ? Is that the same ?
Hm, I suspected you might have been referring to a non-Prizm model, and indeed you were.
I don't really know anything about the 9860 SDK, but presumably its documentation is a bit better than what we've reverse-engineered for the Prizm.
At the risk of sounding ill-informed about the 9XXX series of Casio calcs, is there any reason why there is a dearth of resources available ?
Is it the hackability of them or just that they tend to be a European market thing ? I know the on calc programming is not as sophisticated as the TI.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement