help-gnu-emacs
[Top][All Lists]

## Re: Examples of use of svg.el?

 From: Michael Heerdegen Subject: Re: Examples of use of svg.el? Date: Sat, 02 Apr 2022 03:21:20 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

```Eduardo Ochs <eduardoochs@gmail.com> writes:

>   x0 = 3
>   y0 = 2
>   z = z(x,y) = (x-x0)^2 - (y-y0)^2 + 2
>
> How would you make Calc plot it for x in [x0-1,x0+1] and y in
> [y0-1,y0+1]? Also: how do we access the script that Calc sends to
> gnuplot?
> [...]
> I would _really_ love to make something similar for Calc. Any help
> would be greatly appreciated!

Calc is a cool interactive Calculator, but IMHO it's not so super useful
as programming language or for writing scripts, and it seems that's what
you want to do.

With my current Calc skills I would solve the above task like

' [x0-1 .. x0+1] RET      ; interval
' [y0-1 .. y0+1] RET      ; ditto
' (x-x0)^2 - (y-y0)^2 + 2 ; you could alternatively define a named function
3 s t x0                  ; set x0 to 3
2 s t y0                  ; ditto y0 to 2
M-3 =                     ; updates topmost 3 stack values with vars substituted
g F                       ; draw it

There are probably better ways to handle the constants x0 and y0.  You
can undo the variable substitution with `undo' (surprise!).

g v and g V show communication stuff with gnuplot.  g N to use more
interpolation points (the default is, dunno, 4 or so, you probably want
to change the default in your config: `calc-graph-default-resolution'
and `calc-graph-default-resolution-3d').

That's all I know.  If you are already happy with Maxima, Calc will
probably not be a complete substitute.

Michael.

```