From: uhpvl34 on
How can i write this function in drscheme.
cosx - sinx + 3x2

From: Harald Hanche-Olsen on
+ uhpvl34(a)gmail.com:

| How can i write this function in drscheme.
| cosx - sinx + 3x2

Here's a step by step instruction.

1. Learn the basics of the language.
2. Translate your expression into the target language.
3. Test your solution. If succesful, quit. Otherwise, return to 1.
4. Write to comp.lang.scheme (/not( comp.lang.lisp), explaining what
you wrote, what you expected to happen, and what really did.

--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
than thinking does: but it deprives us of whatever chance there is
of getting closer to the truth. -- C.P. Snow
From: John on
uhpvl34(a)gmail.com wrote:

> How can i write this function in drscheme.
> cosx - sinx + 3x2

which do you mean?

cos(x) - sin(x) + 6
cos(x) - 2*sin(x+3)
cos(x) - sin(2*(x+3))
cos(x) - sin(x+6)
..
..
..


From: GB on
uhpvl34(a)gmail.com wrote:
> How can i write this function in drscheme.
> cosx - sinx + 3x2
>

I don't know about scheme, but in common lisp it is

(+ (- (cos x) (sin x)) (* 3 x x))

assuming you mean (using BASIC syntax)

cos(x) - sin(x) + 3*x^2

Gregg
From: Marco Antoniotti on

GB wrote:
> uhpvl34(a)gmail.com wrote:
> > How can i write this function in drscheme.
> > cosx - sinx + 3x2
> >
>
> I don't know about scheme, but in common lisp it is
>
> (+ (- (cos x) (sin x)) (* 3 x x))
>
> assuming you mean (using BASIC syntax)
>
> cos(x) - sin(x) + 3*x^2

Which in Common Lisp is also :) (with the INFIX package)

#I(cos(x) - sin(x) + 3*x^2)

Cheers
--
Marco