On Thu, May 04, 2023 at 12:15:03PM +0000, '68th' via FriCAS - computer algebra
system wrote:
> i guess this works:
>
> > draw(x=1, x, y, range == [-3..3, -3..3])
>
> because the program uses Cartesian coordinates to make plots, and this
> command has everything to provide those [x=1, y=-3..3]. in case of other
> coordinate systems:
>
> > draw(t=1, t, r, range == [-3..3, -3..3], coordinates==polar)
>
> there are no Cartesian coordinates and the polar(pt) and elliptic(a)
> functions are of no help because theta is constant.
Well, as I wrote in another thread, coordinates work on top of
computation of points. First we get point (x, y), and then
ct((x,y)), where ct is coordinate transformation. ATM I am not
sure why equation plot does not support coordinate transformation.
One possiblity is that original author did not consider them useful.
Anothother may be confusion due to ranges: does range mean
orignal coordinates or the final ones.
> i think a simple solution might be as follows:
>
> if t is not π/2 [incl. ±πn] then x=-3..3 and y=x*tan(theta).
> if t=π/2 or t=3π/2 then x=0 and y=-3..3.
>
> but that would work if the ranges are still for x and y for Cartesian
> coordinates and not for r and theta.
One possiblity of getting transformations is to extract list of
intervals and transform them. One can do:
ob := makeObject(x^2 + y^2 = 1, x, y, range == [-1..1, -1..1])
llp := pointLists(ob)
that gives longish output giving you list of lists of points. Graph
may contain multiple curves, single curve is represented by list
of points. In principle one can transform each point to new
coordinates and in this way transform the whole graph. Namely
ptr := polar$CoordinateSystems(DoubleFloat)
llp1 := [[ptr(p) for p in lp] for lp in llp]
You can get it on the screen via
draw(first(llp1))
or
makeViewport2D(makeGraphImage(llp1)$GraphImage, [])$TwoDimensionalViewport
The first one ('draw') is considered user command, but can only
handle single curve. The second one can handle multiple curves
but the commands are not "exposed" so you need '$GraphImage' part
and '$TwoDimensionalViewport' to tell FriCAS where to find them
(or you could expose GraphImage and TwoDimensionalViewport).
The above has a problem: drawing functions make some effort to
get reasonable approximation to the curve. But after such
simple minded transformation approximation may no longer be
reasonable. For example, if equation is 'x = 1', then it is
a stright line and drawing code uses just two points (part
of line in range is an interval and drawing code just uses
this interval). But after nonlinear transform this will be
curved, so to represent it accurately we need intermediate points.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/20230504221240.5tuwyz5ygfmnuxi6%40fricas.math.uni.wroc.pl.