Ask Your Question

RozaTh's profile - activity

2021-10-22 02:45:11 +0100 marked best answer A problem with fast_callable

I am having a problem with getting consistent results from fast_callable (Sagemath 9.2). Consider the following example:

import numpy as np
x = var('x')
coords(x) = [2.0 * x,  0.0]

c0 = fast_callable(coords[0], vars=[x])
c1 = fast_callable(coords[1], vars=[x])

print(c0(np.array((1.0,2.0))))
print(c1(np.array((1.0,2.0))))

The result of the first print is [2. 4.] as expected but the result of the second print is just 0.0 instead of [0.0,0.0]. In my real application coords dynamically changes, and becuase of this I have to check whether a compomnant is constant or not before applying fast_callable.

1-Is there a way to get a consistent behavior out of fast_callable?

2-Is this a feature or a bug?

2021-10-21 09:09:39 +0100 asked a question A problem with fast_callable

A problem with fast_callable I am having a problem with getting consistent results from fast_callable (Sagemath 9.2). Co

2021-04-14 08:56:21 +0100 received badge  Nice Answer (source)
2021-04-14 00:42:18 +0100 received badge  Necromancer (source)
2021-04-14 00:42:18 +0100 received badge  Teacher (source)
2021-04-14 00:09:25 +0100 answered a question Why `unable to convert (sin(h(x)), cos(h(x))) to a symbolic expression`?

I had the same problem, I don't know the reason why g(x) = f(h(x)) does not work. But this works (Sage 9.2): g(x) = [*f

2021-04-11 19:30:09 +0100 marked best answer Possible problem in bezier_path.py

It seems that the path that is stored by BezierPath is not correct.

Let

p2d = [[(3.0,0.0),(3.0,0.13),(2.94,0.25),(2.8,0.35)],
  [(2.7,0.44),(2.6,0.5),(2.5,0.5)],
  [(2.36,0.5),(2.24,0.44),(2.14,0.35)],
  [(2.05,0.25),(2.0,0.13),(2.0,6.1e-17)]]

then

bezier_path(p2d)[0].path

is different than the given path p2d. There are several consequences to this, for example, the stored path cannot be fed again to bezier_path, so this won't work (results in weird errors):

bezier_path(bezier_path(p2d)[0].path)

and also affects the plot3d method of the class.

The issue seems to stem from line 64 of bezier_path.py:

vertices = self.path[0]

Since the list of vertices changes size after the line so does self.path. I believe the line should be

vertices = deepcopy(self.path[0])
2021-04-11 13:04:37 +0100 received badge  Nice Question (source)
2021-04-11 10:39:18 +0100 received badge  Nice Question (source)
2021-04-11 02:07:59 +0100 asked a question Possible problem in bezier_path.py

Possible problem in bezier_path.py It seems that the path that is stored by BezierPath is not correct. Let p2d = [[(3

2021-04-11 01:48:28 +0100 received badge  Supporter (source)
2021-04-11 00:11:14 +0100 received badge  Student (source)
2021-04-10 23:53:01 +0100 marked best answer Problem with plotting a 3d Bezier curve

I have a problem with plotting a Bezier spline in 3d.

In 2d this simply works:

p2d = [[(3.0,0.0),(3.0,0.13),(2.94,0.25),(2.8,0.35)],
  [(2.7,0.44),(2.6,0.5),(2.5,0.5)],
  [(2.36,0.5),(2.24,0.44),(2.14,0.35)],
  [(2.05,0.25),(2.0,0.13),(2.0,6.1e-17)]]

bezier_path(p2d)

But when I want to plot it in 3d, this line

bezier_path(p2d).plot3d()

or

p3d = [[(3.0,0.0,0.0),(3.0,0.13,0.0),(2.94,0.25,0.0),(2.8,0.35,0.0)],
  [(2.7,0.44,0.0),(2.6,0.5,0.0),(2.5,0.5,0.0)],
  [(2.36,0.5,0.0),(2.24,0.44,0.0),(2.14,0.35,0.0)],
  [(2.05,0.25,0.0),(2.0,0.13,0.0),(2.0,6.1e-17,0.0)]]

bezier3d(p3d)

both give me the following error: TypeError: unable to convert -(t - 1)^3 to an integer.

What am I doing wrong?

2021-04-10 23:53:01 +0100 received badge  Scholar (source)
2021-04-10 19:24:38 +0100 asked a question Problem with plotting a 3d Bezier curve

Problem with plotting a 3d Bezier curve I have a problem with plotting a Bezier spline in 3d. In 2d this simply works: