Exemplo n.º 1
0
int main (){

	//findroot    (1, 2, 10, &fex,  "fex");  //example from class
	//findroot    (0, 5, 10, &fex2, "fex2");  //example from class

	printgraph(-5, 5, 0.001, &f1a, "f1a");
	findinterval(0.2, 0.3, &f1a, "f1a");
	findinterval(1.2, 1.3, &f1a, "f1a");

	findinterval(1,   2, &f1b, "f1b");
	findinterval(1.71828, 4, &f1b, "f1b");

	findinterval(2,   3,   &f1c, "f1c");
	findinterval(3,   4,   &f1c, "f1c");

	findinterval(4,   5,   &f1d, "f1d");

	//printgraph(0, 1, 0.001, &f3b, "f1a");
	findgraph(0, 1, 0.001, &f3b, "f1a");
	//findroot (0, 1, 10, &f3b, "p3b");

	findgraph(0, 1, 0.001, &fex3, "fex3");
	findgraph(4.4, 4.6, 0.001, &fex4, "fex4");
	findgraph(1, 2, 0.01, &fex5, "fex5");
	
}
Exemplo n.º 2
0
static void
fsm_trans(Graph *p, int count, char *curnm)
{	Graph	*r;
	Symbol	*s;
	char	prefix[128], nwnm[256];

	if (!p->outgoing)
		addtrans(p, curnm, False, "accept_all");

	for (s = p->outgoing; s; s = s->next)
	{	r = findgraph(s->name);
		if (!r) continue;
		if (r->outgoing)
		{	(void) set_prefix(prefix, count, r);
			sprintf(nwnm, "%s_%s", prefix, s->name);
		} else
			strcpy(nwnm, "accept_all");

		if (tl_verbose)
		{	printf("maxred=%d, count=%d, curnm=%s, nwnm=%s ",
				Max_Red, count, curnm, nwnm);
			printf("(greencnt=%d,%d, redcnt=%d,%d)\n",
				r->grncnt, r->isgrn[0],
				r->redcnt, r->isred[0]);
		}
		addtrans(p, curnm, r->Old, nwnm);
	}
}
Exemplo n.º 3
0
static void
Addout(char *to, char *from)
{	Graph	*p = findgraph(from);
	Symbol	*s;

	if (!p) return;
	s = getsym(tl_lookup(to));
	s->next = p->outgoing;
	p->outgoing = s;
}
int
main ()
{
  //findgraph ( 2, 3, .1, .0001, 5,    &fsqrt, "Find square Root of 5");
  //findgraph (10,500, 5, .0000001,    5487, &fsqrt, "Find square Root of 5487");

  findgraph ( 0, 1,   .1,  .0001,  0, &hw2p1, "hw2p1");
  findgraph ( 1, 3.2, .1,  .0001,  0, &hw2p2, "hw2p2");
  findgraph ( 1, 2,   .1,  .0001,  0, &hw2p3, "hw2p3");

  findgraph (-1, 0,   .01, .001,  0, &hw2p4, "hw2p4");
  secant (-1, 0, .001,  0, &hw2p4, "hw2p4");
  falseposition (-1, 0, .001,  0, &hw2p4, "hw2p4");

  findgraph (-1, 0,   .01, .00001, 0, &hw2p5, "hw2p5 from -1 to 0");
  findgraph ( 0, 1,   .01, .00001, 0, &hw2p5, "hw2p5 from 0 to 1");
  findgraph (-1 , 1,  .1,  .00001, 0, &hw2p5, "hw2p5 from 0 to 1");

  findpoint (0, 2, 0, 1, .001, 8, &hw2p6, "hw2p6");

  // testing the point function
  //findpoint (0, 2, 1, 1, .001, 8, &hw2p6, "hw2p6");
  //findpoint (1, 3, 2, 4, .001, 8, &hw2p6, "hw2p6");
  //findpoint (1, 4, 0, 2, .001, 8, &hw2p6, "hw2p6");
  //findpoint (1, 8, 18, 0, .001, 8, &hw2p6, "hw2p6");

  findgraph (0, 1, .1,  .01,  12.4,  &hw2p7a, "hw2p7 trough with 12.4 volume");

///*
  printf ("finding a range of values for testing.\n");
  long double i;
  for (i=0; i< 1; i=i+.1){
    char name[40];
    sprintf(name, "hw2p7 %Lf", i);
    //findgraph (0, 1, .01, .00001, i,    &hw2p7, name);
    hw2p7(i, 0);
    hw2p7a(i, 0);
  }
//*/

  //findgraph (-1, 3, .1, .001, 38, &hw2ptri, "hw2ptri full");
  //findgraph (-1, 3, .1, .001, 10, &hw2ptri, "hw2ptri half full");
  //findgraph (-1, 3, .1, .001, .1, &hw2ptri, "hw2ptri empty");

  //findgraph   ( 0, 2, .1, .00000001, 0, &fex, "fex");
}