Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Prog i need your wisdom

Name: anonymous coward 2012-04-18 20:44

No this isn't a joke, or a meme or a fad or whatever you think it is. It just a
regular programming problem.

I'm making a ASCII-art math generator. So you can input in your document
Maxima-notation math and get a corresponding representation. Example:

>Integrate(x^2,x,0,5)

  5 __
   / 2
 _/ x  dx
 0

While a got the AST right. When making the representation on ASCII-text I hit a
problem. The inner-term can change the structure of the outer ones, so this
isn't straight forward

>integrate(x,x,0,5)
>integrate(x+3/2,x,0,5)

  5 __
   / 
 _/ x  dx
 0           

   5 ______
    /   3
   /x + -   dx
 _/     2
 0

 Which is the simplest approach to this?

 Pd: I am not telling in what I'm implementing it so it doesn't derail.

Name: Anonymous 2012-04-18 20:53

Hey, can anyone else post new threads? I keep getting an error every time I try.

Sorry OP, I don't know the answer to your problem.

Name: Anonymous 2012-04-18 20:54

>>2
probably some cookie setting.

Name: Anonymous 2012-04-18 21:03

>>3
No, my cookie settings are all in order.

I get the message "A fatal error occurred! Thread ID specified does not exist." followed by what I wrote.

I'm clicking the "Create new thread" button at the bottom of the page, but this happens every time. I don't want to hijack someone else's thread for my own question. I can still reply, though.

Name: Anonymous 2012-04-18 21:11

OP, do you mind if I hijack your thread for a few posts? It's a really simple problem, probably. I'm new to Java, and programming in general.

Hey /prog/, I'm trying to make a program that displays a base to an exponent, and all exponents before it. Here's where the line screws up.

for (i = exponent; i <= 10; i--) {
            outputField.setText(base + " to the exponent " + i + " = " + Math.pow(base, i) + "\n");
        }

So if someone were to say 2 for base, and 6 for exponent, it would show 2^6 all the way down to 2^1 in a sequence. Unfortunately, it just freezes instead. exponent and base are set as int, so that should make i an int too, right? Is the problem that it's trying to solve for every number equal to or less than 0?

Name: Anonymous 2012-04-18 21:20

>>1,3
Shared IP? If I post a reply, I can't make a thread for a while. Perhaps it is someone else making a post to /prog/ when you try to make a thread?

Name: Anonymous 2012-04-18 21:22

>>5
yeah, it wasn't going anywhere anyways

Name: Anonymous 2012-04-18 21:24

>>6
That's what I read online, but I've tried refreshing and posting again multiple times, and I know no has posted in between, and each time the error comes up.

By shared IP, do you mean someone else in my house is doing something here? Because I REALLY doubt that. Or I could be misinterpreting what you're saying.

Name: Anonymous 2012-04-18 21:25

>>7
HOT DAMN, I just noticed the +i+.

GONNA TRY THIS OUT. FUCKING TYPOS.

Name: Anonymous 2012-04-18 21:26

>>9
HOT DAMN, I'm a retard. Gogdmanit.

Name: Anonymous 2012-04-18 21:27

I am giving 50 bucks to anyone who can answer the OP question.

Name: Anonymous 2012-04-18 21:34

I apologize for derailing your thread, OP.

Name: Anonymous 2012-04-18 21:35

>>12
no evil, no harm, go do your homework

Name: Anonymous 2012-04-18 21:42

>>8
I meant something like a NAT.

Name: Anonymous 2012-04-18 21:49

>>14
So it's making it difficult to accept end-to-end connectivity?

I don't think I have one (if I'm getting the gist of this correctly).

Name: Anonymous 2012-04-18 22:13

>>15
hum check the server response and browser request, webdeveloper/fiddler/firebug or a packet tracer should do the job

>>5
what do you mean "screw up"? exception? warning on compilation? wrong output?

Name: Anonymous 2012-04-18 22:15

ONE MORE FINAL

Geh, I've just about figured it out.

for (i = exponent; i >= 1; i--) {
            outputField.setText(base + " to the exponent " + exponent-- + " = " + Math.pow(base, exponent) + "\n");
        }

When I put

System.out.println(base + " to the exponent " + exponent-- + " = " + Math.pow(base, exponent));

It shows up correctly, but when I try to get it to show in the text box, it only does the last line. How would I go about getting it to show the others? Also, how could I rearrange the order so it shows ^1 first instead of last? It's counting backwards, not forwards.

Name: Anonymous 2012-04-18 22:21

oh...so it only shows the last line...simply put, the fieldset has an associated buffer, when you call setText you SET the contents of that buffer, when you call println you APPEND something to some buffer, in this case to a file stream shown somewhere

why are you using something graphical if you didn't get there yourself

Name: Anonymous 2012-04-18 22:30

>>18
Because I'm a moron, and my teacher just says that's what he wants. We used println for the very first assignment way back when, and then started using graphics. He didn't explain much about how they work.

I really wish he explained programming terminology, because every time I look some up, it explains it in more terminology I can't understand, and the cycle continues. I feel like an idiot.

Name: Anonymous 2012-04-18 22:39

>>18
Oh yeah, I forgot to ask, does that mean I can't use setText()?

Name: Anonymous 2012-04-18 23:47

Name: Anonymous 2012-04-19 7:08

>>1
Well what I think would be the simplest way would be to track the vertical bounds of the notation based on the expression and the rules of the notation. Getting the program to resolve to the correct value for the vertical bounds of every expression is an exercise left to the breeder.

Name: bampu pantsu 2012-05-29 4:30

bampu pantsu

Name: Anonymous 2013-11-30 8:11

░░░░░░░▄▀▀▀▀▀▀▀▀▀▀▄▄░░░░░░░░░
░░░░▄▀▀░░░░░░░░░░░░░▀▄░░░░░░░
░░▄▀░░░░░░░░░░░░░░░░░░▀▄░░░░░ YOU HAVE BEEN VISITED BY
░░█░░░░░░░░░░░░░░░░░░░░░▀▄░░░ LE 'FEEL OF NO GF
░▐▌░░░░░░░░▄▄▄▄▄▄▄░░░░░░░▐▌░░
░█░░░░░░░░░░░▄▄▄▄░░▀▀▀▀▀░░█░░ A qt 3.14 gf will come to you,
▐▌░░░░░░░▀▀▀▀░░░░░▀▀▀▀▀░░░▐▌░ but ONLY if you post a
█░░░░░░░░░▄▄▀▀▀▀▀░░░░▀▀▀▀▄░█░ `>tfw no GF on this thread
█░░░░░░░░░░░░░░░░▀░░░▐░░░░░▐▌
▐▌░░░░░░░░░▐██▀█▄░░░░░░█▀█░▐▌
░█░░░░░░░░░░░▀▀▀░░░░░░▀▀▀▀░▀▄
░▐▌░░░░▄░░░░░░░░░░░░░▌░░░░░░█
░░▐▌░░▐░░░░░░░░░░░░░░▀▄░░░░░█
░░░█░░░▌░░░░░░░░▐▀░░░░▄▀░░░▐▌
░░░▐▌░░▀▄░░░░░░░░▀░▀░▀▀░░░▄▀░
░░░▐▌░░▐▀▄░░░░░░░░░░░░░░░░█░░
░░░▐▌░░░▌░▀▄░░░░▀▀▀▀▀▀░░░█░░░
░░░█░░░▀░░░░▀▄░░░░░░░░░░▄▀░░░
░░▐▌░░░░░░░░░░▀▄░░░░░░▄▀░░░░░
░▄▀░░░▄▀░░░░░░░░▀▀▀▀█▀░░░░░░░

Don't change these.
Name: Email:
Entire Thread Thread List