CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 140 users online: 13 members, 103 guests and 24 bots.
Members: 16aroth6, Ashbad, blue_bear_94, critor, rfdave, roblabla, Xeda112358.
Bots: MSN/Bing (1), Magpie Crawler (5), Yahoo! Slurp (1), Googlebot (16), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
Author Message
prizmos


Newbie


Joined: 16 Jul 2012
Posts: 13

Posted: 11 Aug 2012 04:08:40 am    Post subject: programm in C to solve equations?

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?
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55732
Location: Earth, Sol, Milky Way

Posted: 11 Aug 2012 06:13:00 am    Post subject:

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.
_________________


Back to top
prizmos


Newbie


Joined: 16 Jul 2012
Posts: 13

Posted: 11 Aug 2012 07:38:16 am    Post subject:

I can't find gCAS2 here. Where is it? Are there any instructions how to use it?
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55732
Location: Earth, Sol, Milky Way

Posted: 11 Aug 2012 08:18:11 am    Post subject:

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.
_________________


Back to top
prizmos


Newbie


Joined: 16 Jul 2012
Posts: 13

Posted: 11 Aug 2012 08:54:36 am    Post subject:

I found only GlaßOS files on sourceforge, nothing about gCAS2. What about your modified version? Can you upload it?
Back to top
AHelper


LONG LIVE COMICTECH


Joined: 30 Jan 2011
Posts: 1656
Location: Aufhelperstan, Utopian Republic

Posted: 11 Aug 2012 10:41:21 am    Post subject:

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.
_________________
°ᴥ° Get Lucky

<BrandonW> "You don't even want to know what TI Connect does when it's just detecting your calculator...It ACTUALLY ERASES THE SWAP SECTOR on every communication attempt...EVERY SINGLE ATTEMPT...Yes, TI Connect will kill your calculator..What do I have to do to get your attention?!....Such a bloated protocol."
Back to top
prizmos


Newbie


Joined: 16 Jul 2012
Posts: 13

Posted: 11 Aug 2012 11:58:24 am    Post subject:

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?


Last edited by prizmos on 12 Aug 2012 04:40:29 am; edited 1 time in total
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55732
Location: Earth, Sol, Milky Way

Posted: 13 Aug 2012 08:31:41 am    Post subject:

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
}

_________________


Back to top
prizmos


Newbie


Joined: 16 Jul 2012
Posts: 13

Posted: 13 Aug 2012 09:25:23 am    Post subject:

and I was giving up hope...

Thanks KermMartian and AHelper, you are great!!!
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55732
Location: Earth, Sol, Milky Way

Posted: 13 Aug 2012 12:32:52 pm    Post subject:

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
_________________


Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 
Jump to:  
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

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.030055 seconds.