Hello Chris,

2014-08-29 18:46 UTC+02:00, Chris Corio <chris.co...@gmail.com>:
> somewhat complex system of equations and I'm trying to solve them under
> certain conditions.
>
> I have a system of equations:
> var('x y h k r t d')
> eq1 = x^2 + y^2 == d^2
> eq2 = y == tan(t) * x
> eq3 = (x-h)^2 + (y-k)^2 == r^2
> eq4 = -1 * r < k < r
> eq5 = -1 * r < h < r
>
> I'm trying to solve these equations in two ways:
> 1. I'd like to pass in a set of values for t and d for a given r and
> approximate h and k.  I'm expecting around 30-50 values and some will be
> less accurate than others so I need a way to cull bad values.
> 2. I'd like to pass in t, h, k, r and get the possible values for d (there
> can be two, if I'm not mistaken)
>
> Can anyone point me at the functions that I can use to solve these
> equations or have any suggestions for the solutions?  I appreciate the
> help.

A first step is to use the method `.subs` (for substitute) of symbolic
expressions as in the following
{{{
sage: var('x y h k r t d')
(x, y, h, k, r, t, d)
sage: eq1 = x^2 + y^2 == d^2
sage: eq2 = y == tan(t) * x
sage: eq3 = (x-h)^2 + (y-k)^2 == r^2
sage: eq4 = -1 * r < k < r
sage: eq5 = -1 * r < h < r
sage: eqs = [eq1,eq2,eq3,eq4,eq5]
sage: for (r0,t0,d0) in [(1,2,3),(4,5,6)]:
....:     sub_eqs = [eq.subs(r=r0,t=t0,d=d0) for eq in eqs]
....:     print sub_eqs
....:
[x^2 + y^2 == 9, y == x*tan(2), (h - x)^2 + (k - y)^2 == 1, -1 < k, -1 < h]
[x^2 + y^2 == 36, y == x*tan(5), (h - x)^2 + (k - y)^2 == 16, -4 < k, -4 < h]
}}}

Vincent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to