Hi all,

I want to have some equations saved on my Prizm with some text. Each equation can be chosen and solved. How can I accomplish this in C? Can it be easily done using "Solver" itself or a Prizm integrated function?

Can you please enlighten me?
You'll need a CAS, or Computer Algebra System. AHelper's gCAS2 is currently the CAS of choice for the Prizm, being designed to be small and lightweight and work despite a few missing stdlib functions in PrizmSDK. However, it's also a work in progress, and hence missing some features and capabilities. There are some open-source CASes out there that might be good to try porting, as well.
I can't find gCAS2 here. Where is it? Are there any instructions how to use it?
prizmos wrote:
I can't find gCAS2 here. Where is it? Are there any instructions how to use it?
It is somewhere inside Ahelper's repository at http://glassos.sourceforge.net . I also have a modified version good for the PrizmSDK.
I found only GlaßOS files on sourceforge, nothing about gCAS2. What about your modified version? Can you upload it?
The GlaßOS project consists of the kernel, system apps, and other programs. From the top of my head, you can find the source of gCAS2 at http://glassos.svn.sf.net/svnroot/glassos/trunk/src/gCAS2/. You will also need KermM's additions for getting it to compile on the Prizm.
Quote:
It is somewhere inside Ahelper's repository at http://glassos.sourceforge.net . I also have a modified version good for the PrizmSDK.


Quote:
The GlaßOS project consists of the kernel, system apps, and other programs. From the top of my head, you can find the source of gCAS2 at http://glassos.svn.sf.net/svnroot/glassos/trunk/src/gCAS2/. You will also need KermM's additions for getting it to compile on the Prizm.


gCAS2 found, now KermM's additions missing...

@KermMartian: You wrote, you have a modified version. Where is it?
Is this what AHelper means with your additions?

Where can I find them? What's the next step?

Is there any chance that any of you developers to provide us newbies with a step by step guide here or even better to integrate the guide in the wiki?
By the way, if it's been more than 24 hours and no one has responded, you are allowed to bump a topic by double-posting; it's not against etiquette. Smile I only have it locally on my computer and as part of a private Mercurial repository, but I can package up my current version and send it along to you. Would you PM me an email address at which I can reach you?

The additions and modifications I have are:

(1) Making gCAS2 work with PrizmSDK
(2) Implementing some of the trig functions (sin, cos, tan, atan)

AHelper would be a better guide to using gCAS2 than me, but I will show you a sample bit of code taken and modified from pieces of Graph3DP:


Code:
// Initialize equation and variables, get parse tree of equation
char* thiseq = "3*sin(X+2Z)";
memset(vars,0,sizeof(cas_var)*MAX_NUM_VARS);   //XXXX ? 2012-06-18 suggest removal
tree = gcas_parse(&thiseq,0,0,(cas_node*)CASERR_FIRST_PARSE,0,vars,MAX_NUM_VARS);
free(saveeq);

// Check if equation was successfully parsed or was poorly-formed
if (parse_is_error(tree)) {
   equations[i].valid = 0;
   printf("Invalid equation...");
   exit(-1);
}

// Set "X" and "Y" variables to val_x and val_y
if (0 > (id = gcas_get_var_id(vars, "X", MAX_NUM_VARS))) return -1;
if (0 > gcas_setvariable_float(vars,id,"X",val_x)) return -1;
if (0 > (id = gcas_get_var_id(vars, "Y", MAX_NUM_VARS))) return -1;
if (0 > gcas_setvariable_float(vars,id,"Y",val_y)) return -1;

// Evaluate the tree (plug in X and Y and simplify)
gcas_tree_eval(&tree, vars, MAX_NUM_VARS, lApprox | lBasic);   
                  
if (tree->type == nNUMBER) { //if the output was a number...
   printf("%f\t%f\t%f\n",val_x,val_y,tree->number.nN); //print it
}
and I was giving up hope...

Thanks KermMartian and AHelper, you are great!!!
prizmos wrote:
and I was giving up hope...

Thanks KermMartian and AHelper, you are great!!!
Don't give up, we love to help. We just aren't always able to answer threads in a timely manner. For what it's worth, I open a bunch of tabs I need to answer, then sometimes end up re-editing the post I'm composing for days. I have two networking-related threads open in my browser that have been awaiting completed posts for four days, for instance. Smile
  
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