例:
list:={ Plus[1,1], Times[2,3] }
Run Code Online (Sandbox Code Playgroud)
看着list,我明白了
{2,6}
Run Code Online (Sandbox Code Playgroud)
我想让他们不受评估(如上所述)以便list返回
{ Plus[1,1], Times[2,3] }
Run Code Online (Sandbox Code Playgroud)
后来我想评估列表序列中的函数来获取
{2,6}
Run Code Online (Sandbox Code Playgroud)
未评估的函数的数量list事先是未知的.此外Plus,f[x_]可以存储用户定义的功能list
我希望这个例子很清楚.
做这个的最好方式是什么?
如果我理解Mathematica文档是正确的(也没有找到示例)Graphics3D不会产生3D对象的阴影,尽管Graphics3D有一个Lighting->选项.
问题:您是否曾尝试使用阴影生成Mathematica 3D对象?如果是这样,你在Mathematica中解决了这个问题?或者您是否已将图形导出到其他3D(场景图)查看器,例如J-Reality?
考虑以下使用幽灵,试剂和重构框架的clojurescript代码,外部React.js网格组件用作视图组件.
在db.cls中:
(def default-db
{:cats [{:id 0 :data {:text "ROOT" :test 17} :prev nil :par nil}
{:id 1 :data {:text "Objects" :test 27} :prev nil :par 0}
{:id 2 :data {:text "Version" :test 37} :prev nil :par 1}
{:id 3 :data {:text "X1" :test 47} :prev nil :par 2}]})
Run Code Online (Sandbox Code Playgroud)
在subs.cls中
(register-sub
:cats
(fn [db]
(reaction
(select [ALL :data] (t/tree-visitor (get @db :cats))))))
Run Code Online (Sandbox Code Playgroud)
选择结果:
[{:text "ROOT", :test 17}
{:text "Objects", :test 27}
{:text "Version", :test 37}
{:text "X1", :test 47}]
Run Code Online (Sandbox Code Playgroud)
在views.cls中 …
我想为Mathematica 3D图形添加交互性,而不是Manipulate,它很酷但有其局限性.想想Mathematica中四个立方体问题演示的四个例子,点击其中一个立方体就会旋转一个立方体.
问题.
是否有可能在Mathematica图形中捕获MouseEvents(例如使用Java类或其他?)
或者是使用Java然后从Java调用Mathematica建议路由?
或者(我希望不是)正在开发超出Mathematica应该做的交互式图形程序?
如何检查是否没有为函数提供参数?
例如,如果我有:
f[x_Integer]:=1
f[x_]:=Message[errm::err, x]
Run Code Online (Sandbox Code Playgroud)
我没有争吵地打电话给f:
f[]
Run Code Online (Sandbox Code Playgroud)
"没有任何反应",我想强迫一个特定的(错误)条件.
(背景:我正在为包和OO-System类进行MUnit测试.)
我从未在Mathematica中出现溢出错误,发生了以下情况.
我演示了RSA加密的原理如下:
n = 11*13
m = EulerPhi[n]
e = 7
GCD[e, m]
d = PowerMod[e, -1, m]
cipher2[m_String] := Map[Mod[#^e, n] &, ToCharacterCode[m]]
decipher2[x_Integer] := FromCharacterCode[Map[Mod[#^d, n] &, x]]
In[207]:= cipher2["StackOverflow"]
decipher2[cipher2["StackOverflow"]]
Out[207]= {8,129,59,44,68,40,79,62,49,119,4,45,37}
Out[208]= StackOverflow
Run Code Online (Sandbox Code Playgroud)
没有问题.
然后我将质数更改为更现实,但仍然非常适中.
n = 252097800611*252097800629
In[236]:= cipher2["StackOverflow"]
decipher2[cipher2["StackOverflow"]]
Out[236]= {27136050989627, 282621973446656, 80798284478113, \
93206534790699, 160578147647843, 19203908986159, 318547390056832, \
107213535210701, 250226879128704, 114868566764928, 171382426877952, \
207616015289871, 337931541778439}
During evaluation of In[236]:= General::ovfl: Overflow occurred in computation. >>
During evaluation of In[236]:= General::ovfl: Overflow occurred in …Run Code Online (Sandbox Code Playgroud) 我正在玩(美丽的)多项式x^4 - 10x^2 + 1.看看会发生什么:
In[46]:= f[x_] := x^4 - 10x^2 + 1
a = Sqrt[2];
b = Sqrt[3];
Simplify[f[ a + b]]
Simplify[f[ a - b]]
Simplify[f[-a + b]]
Simplify[f[-a - b]]
Out[49]= 0
Out[50]= 0
Out[51]= 0
Out[52]= 0
In[53]:= Solve[f[x] == 0, x]
Out[53]= {{x->-Sqrt[5-2 Sqrt[6]]},{x->Sqrt[5-2 Sqrt[6]]},{x->-Sqrt[5+2 Sqrt[6]]},{x->Sqrt[5+2 Sqrt[6]]}}
In[54]:= Simplify[Solve[f[x] == 0, x]]
Out[54]= {{x->-Sqrt[5-2 Sqrt[6]]},{x->Sqrt[5-2 Sqrt[6]]},{x->-Sqrt[5+2 Sqrt[6]]},{x->Sqrt[5+2 Sqrt[6]]}}
In[55]:= FullSimplify[Solve[f[x] == 0, x]]
Out[55]= {{x->Sqrt[2]-Sqrt[3]},{x->Sqrt[5-2 Sqrt[6]]},{x->-Sqrt[5+2 Sqrt[6]]},{x->Sqrt[2]+Sqrt[3]}}
Run Code Online (Sandbox Code Playgroud)
Sqrt[5-2 Sqrt[6]]等于Sqrt[3]-Sqrt[2].
但是,Mathematica …
我有IntelliJ 12.0和gradle 1.2.在Windows 7上.当我尝试导入build.gradle文件时,我在IntelliJ中收到以下错误消息.我在这里有点迷失.有想法该怎么解决这个吗?
(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.jetbrains.plugins.gradle.remote.GradleApiException:
Could not fetch model of type 'BasicIdeaProject' using Gradle installation 'C:\Program Files (x86)\gradle-1.2'.
The newly created daemon process has a different context than expected.
It won't be possible to reconnect to this daemon. Context mismatch:
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=c:\program files (x86)\jetbrains \intellij idea 12.0\jre\jre,daemonRegistryDir=C:\Users\Nilo\.gradle \daemon,pid=5144,idleTimeout=null,daemonOpts=-XX:MaxPermSize=256m,-XX: +HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252]
Actual: DefaultDaemonContext[uid=d8c5c4bc-5488-42c2-b4b3-28c1d53afacf,javaHome=C: \Program Files (x86)\JetBrains\IntelliJ IDEA 12.0\jre,daemonRegistryDir=C:\Users\Nilo \.gradle\daemon,pid=6880,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252]
at org.jetbrains.plugins.gradle.remote.impl.GradleProjectResolverImpl.resolveProjectInfo(GradleProjectResolverImpl.java:61)
... 21 more
Run Code Online (Sandbox Code Playgroud) 使用Graphics3D显示某些图形对象后,您可以通过交互式更改ViewPoint选项或简单地拖动,调整大小或旋转图像来移动图像.后者是否会在内部更改ViewPoint?可以查询一下吗?
例如.
按程序:
Manipulate [
viewpoint->{x,y,y};
Graphics3D[Cuboid[],ViewPoint->viewpoint],
,{x,-25,25}
,{y,-25,25}
,{z,-25,25}]
Run Code Online (Sandbox Code Playgroud)
通过'鼠标'
Graphics3D[
Cuboid[]]
Run Code Online (Sandbox Code Playgroud)
可以模拟上述程序的效果.我可以通过旋转来查询对ViewPoint的影响吗?
背景:
a = 0; b = 0; c = 0;
Manipulate[Graphics3D[
GeometricTransformation[
{Cuboid[{0, 0, 0}, {1, 1, 1}]},
{RotationTransform[x, {1, 1, 0}, {a, b, c}]}],
ViewPoint -> Left], {x, 0, 2 \[Pi]}]
Run Code Online (Sandbox Code Playgroud)
我的问题涉及具有以下签名的RotationTransform:
RotationTransform[x, {1, 1, 0}, {a, b, c}]
Run Code Online (Sandbox Code Playgroud)
文档说:"围绕轴固定在点p处进行3D旋转",在上面的示例中,w = {1,1,0}并且p = {a,b,c}.
令我惊讶的是,无论我指定给(a,b,c)什么值,旋转都是相同的.我假设我不理解文档,在某处犯了错误.我原本期望a,b,c的不同值至少有不同的旋转.更改向量w的行为与预期一致.